比如
<script type="text/javascript">
if (0) {
</script>
<p> hello1</p>
<script type="text/javascript">
}else{
</script>
<p> hello2</p>
<script type="text/javascript">
}
</script>
就是通過條件來控制輸出 hello1或者hello2
這樣行嗎?
document.write就好了
<script type="text/javascript">
if (0) {
document.write('<p> hello1</p>')
}else{
document.write('<p> hello2</p>')
}
</script>