因此,我使用以下代码运行parenscript教程:
(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>这不起作用。我需要用引号关闭警告函数,而不是用分号。我做错了什么?
发布于 2018-01-08 03:15:36
好的,在看了一大堆之后,我发现这个教程似乎是错的。您应该使用parenscript:ps-inline来正确引用,而不是使用parenscript:ps来生成代码。
希望这对其他人有帮助。
https://stackoverflow.com/questions/48140596
复制相似问题