我有这个代码:
<script type="text/javascript">
function js() {
var getJs = document.getElementById("jogo");
if (JS == true) { //if button JS is pressed - it is correct?
< script type = "text/javascript"
src = "file1.js" >
} else < script type = "text/javascript"
src = "file2.js" >
</script>
}
</script>
它不起作用。我给了两个按钮,如果第一个被按下,file1.js
应该是加载的。如果按下第二个,file2.js
则应加载。
我怎样才能做到这一点?