我试图在html标签中插入一个JS变量,我不知道我做错了什么.电影无法加载.这是我的代码:
var moviePath = "images/main.swf";
<script>document.write('<PARAM name="movie" value="' + moviePath + '">')</script>
Run Code Online (Sandbox Code Playgroud)
您的var似乎在您的脚本之外..?
尝试:
<script type="text/javascript">
var moviePath = "images/main.swf";
document.write('<param name="movie" value="' + moviePath + '">');
</script>
Run Code Online (Sandbox Code Playgroud)