我试图让自己脱离经典ASP。我已经开发出替代技术来处理HTML / JavaScript中的所有内容。但是,我仍然需要一些方法来替换以下内容:
{{1}}
有没有办法在纯HTML / JavaScript中完成条件分支/条件代码?
答案 0 :(得分:0)
客户端脚本的document.writeln:
<html>
<head>
</head>
<body>
<br />Some html code before<br /><br />
<script language="javascript">
var This = true;
if(This){
document.writeln("<div>Wow. This. Totally this. Isn't this great?</div>");
}
else{
document.writeln("<div>You're really missing out on this.</div>");
}
</script>
<br />Some html code after<br /><br />
<script language="javascript">
var This = false;
if(This){
document.writeln("<div>Wow. This. Totally this. Isn't this great?</div>");
}
else{
document.writeln("<div>You're really missing out on this.</div>");
}
</script>
<br />Some other html code after<br /><br />
</body>
注意:在你的例子中,你使用了&#34;这个&#34;,我用了#34;这个&#34;,&#34;这个&#34;在javascript中是一个保留字