我有下面的代码。目标是检查Name变量是否以TBD开头。如果这样做,整个变量将被填充到另一个位置。但是,当且仅当它以“TBD - Hot”开头才会被区别对待。检查字符串是否以另一个字符串开头?
<script type = "text/javascript">
if ("%%%Name%%%"=="TBD") {document.write('<iframe width="100%" height="550" frameborder="0" scrolling="yes" marginheight="0" marginwidth="0" src=""></iframe>');
}
else if ("%%%Name%%%"=="TBD - HOT") {document.write('<iframe width="100%" height="550" frameborder="0" scrolling="yes" marginheight="0" marginwidth="0" src=""></iframe>');
}
else {document.write('<iframe width="100%" height="550" frameborder="0" scrolling="yes" marginheight="0" marginwidth="0" src=""></iframe>');
}
</script>