Applescript的Javascript变量

Applescript的Javascript变量,javascript,applescript,Javascript,Applescript,我正在使用以下代码: set javaScriptVar to "var body = document.body, html = document.documentElement; var height = Math.max(body.scrollHeight, body.offsetHeight, html.scrollHeight, html.offsetHeight); return height" set myJSvar to do JavaScript javaScriptVar

我正在使用以下代码:

set javaScriptVar to "var body = document.body, html = document.documentElement; var height = Math.max(body.scrollHeight, body.offsetHeight, html.scrollHeight, html.offsetHeight); return height"

set myJSvar to do JavaScript javaScriptVar in document 1

display alert myJSvar
我得到的值是:
msng

这有什么问题吗?

试试:

set javaScriptVar to "var body = document.body; html = document.documentElement; var height = Math.max(body.scrollHeight, body.offsetHeight, html.scrollHeight, html.offsetHeight); height;"

tell application "Safari" to set myJSvar to do JavaScript javaScriptVar in document 1
尝试: