Common lisp cl who、parenscript和引号问题生成内联javascript
因此,我使用以下代码运行parenscript教程:Common lisp cl who、parenscript和引号问题生成内联javascript,common-lisp,hunchentoot,cl-who,parenscript,Common Lisp,Hunchentoot,Cl Who,Parenscript,因此,我使用以下代码运行parenscript教程: (defparameter *js-string-delimiter* #\") (hunchentoot:define-easy-handler (tutorial1 :uri "/tutorial1") () (cl-who:with-html-output-to-string (s) (:html (:head (:title "Parenscri
(defparameter *js-string-delimiter* #\")
(hunchentoot:define-easy-handler (tutorial1 :uri "/tutorial1") ()
(cl-who:with-html-output-to-string (s)
(:html
(:head (:title "Parenscript tutorial, example 1"))
(:body (:h2 "Parenscript totorial: 1st example")
"Please click the link below." :br
(:a :href "#" :onclick (parenscript:ps (alert "Hello World!"))
"Hello World!")))))
页面呈现,但可单击链接不起作用。当我查看源代码时,我得到以下信息:
<html><head><title>Parenscript tutorial, example 1</title></head><body><h2>Parenscript totorial: 1st example</h2>Please click the link below.<br /><a href='#' onclick='alert('Hello World!');'>Hello World!</a></body></html>
Parenscript教程,示例1 Parenscript totorial:1st示例请单击下面的链接。
这是行不通的。我需要用引号括起来的警报函数,而不是半引号。我做错了什么?好的,经过一番观察,我发现教程似乎是错的。与其使用parenscript:ps生成代码,不如使用parenscript:ps内联来获得正确的引号 希望这对其他人有所帮助。你好,我的2c:我更喜欢:更容易编写宏的语义,html验证(带有警告,方便),可以包括标记等等。