gpt4 book ai didi

javascript - 我可以在 JavaScript 中运行 JavaScript 吗?

转载 作者:行者123 更新时间:2023-11-29 10:49:31 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Is It Possible to Sandbox JavaScript Running In the Browser?

我想让用户能够像这样在文本区域中输入 JavaScript:

<!DOCTYPE html>
<html>
<head>
<script>
function lapzwans()
{
var d = document.getElementById("area").value;
document.getElementById("blahblah").innerHTML = d;
}
</script>
</head>
<body>
<h1>Javascript in Javascript</h1>
<p>This experiment attempts to launch a script from another script.</p>
<p>Enter your script in the text area</p>
<textarea type="text" id="area"></textarea>
<button onclick="lapzwans()">Click here</button>
<p id="blahblah"></p>
<p id="deegroller">Make this text green</p>
</body>
</html>

我试过了,但是没有结果。
是做不到还是我做错了?
提前致谢。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com