cl-who,parenscript和引号问题生成内联javascript

时间:2018-01-07 19:05:11

标签: 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 "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>

哪个不起作用。我需要用引号“,而不是半引号”关闭警报功能。我做错了什么?

1 个答案:

答案 0 :(得分:2)

好的,经过一番环顾,我发现这个教程看起来是错的。而不是使用parenscript:ps来生成代码,您应该使用parenscript:ps-inline来使引用正确。

希望这有助于其他人。

相关问题