Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用loop作为变量播放MP3 x='true'; 功能播放(文件){ document.getElementById('player').innerHTML=“”; }_Javascript_Html - Fatal编程技术网

Javascript 使用loop作为变量播放MP3 x='true'; 功能播放(文件){ document.getElementById('player').innerHTML=“”; }

Javascript 使用loop作为变量播放MP3 x='true'; 功能播放(文件){ document.getElementById('player').innerHTML=“”; },javascript,html,Javascript,Html,这段代码可以工作,但是如何用loop=x替换loop=\“false\”。我尝试了各种括号等组合。x=true; x='true'; function play(file){ document.getElementById('player').innerHTML="<embed src=\""+file+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />"; } 功能播放(文件){ document.getEl

这段代码可以工作,但是如何用
loop=x
替换
loop=\“false\”
。我尝试了各种括号等组合。

x=true;
x='true';

function play(file){
    document.getElementById('player').innerHTML="<embed src=\""+file+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";
}
功能播放(文件){ document.getElementById('player').innerHTML=“”; }
循环不是布尔值,不是整数吗?
x=true;

function play(file){
document.getElementById('player').innerHTML="<embed src=\""+file+"\" hidden=\"true\" autostart=\"true\" loop=\"" + x +"\" />";
}