【问题标题】:cl-who, parenscript, and quotation mark issues generating inline javascript生成内联 javascript 的 cl-who、parenscript 和引号问题
【发布时间】:2018-06-16 20:37:27
【问题描述】:

所以我正在使用以下代码运行 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>

这不起作用。我需要用引号括起来的警报功能“,而不是半引号”。我做错了什么?

【问题讨论】:

  • 你好,我的 2c:我更喜欢spinneret:更容易编写宏的语义,html 验证(带有警告,方便),可以包括降价,更多。

标签: common-lisp hunchentoot cl-who parenscript


【解决方案1】:

好的,看了一圈,发现教程好像错了。您应该使用 parenscript:ps-inline 来获得正确的引用,而不是使用 parenscript:ps 来生成代码。

希望这对其他人有所帮助。

【讨论】:

    猜你喜欢
    • 2018-06-03
    • 1970-01-01
    • 1970-01-01
    • 2011-04-17
    • 2011-06-07
    • 2010-12-18
    • 1970-01-01
    • 2018-05-25
    • 1970-01-01
    相关资源
    最近更新 更多