我想要将位于hello.html上的<script></script>
标记中的数据转换为index.html。我怎样才能做到这一点?从其他文件中获取数据
的index.html:
<head>
<script>
// some codes
</script>
</head>
<body>
<div>
<!-- result will be come here -->
</div>
</body>
</html>
hello.html的:
<html>
<head>
</head>
<body>
<script>
document.writeln("hello world");
</script>
</body>
</html>
编辑:我希望 “document.writeln(” 世界你好 “);”部分,它必须是字符串。
您更好的移动脚本传送至外部文件,那么你可以有'<脚本类型=“文本/ javascript“src =”myfile.js“>'在这两个.html文件中。否则,几乎不可能做你想要的东西。 –
我同意暗影向导。 @doruk你的问题并不清楚,如果你想要使用JavaScript将数据从一个页面发送到另一个页面,请使用带查询字符串值的重定向。 – Warlock
编辑已添加到问题中。我想要“document.writeln(”hello world“);”脚本的一部分,它必须是字符串。 – doruk