我试图动态地将房间添加到嵌入的tokbox中,我具有变量存储,需要用myroom的值替换DEFAULT_ROOM
我尝试了str.replace函数,但这不起作用
var myroom = getParameterByName1(1234);
function myFunction()
{
var str = document.getElementById("demo").innerHTML;
var res = str.replace('DEFAULT_ROOM',myroom );
document.getElementById("holder").innerHTML = res;
}
</script>
<noscript>
<p>This site uses JavaScript. You must allow JavaScript in your browser.
</p>
</noscript>
<p id="holder">
<div id="otEmbedContainer" style="width:800px;
height:640px">
</div>
<script src="https://tokbox.com/embed/embed/ot-embed.js?embedId=<embed-
id>&room=DEFAULT_ROOM">
</script></p>
</body>
我希望将DEFAULT_ROOM替换为myroom变量中的值。但是DEFAULT_ROOM不会更改。