我有这个脚本,我正在尝试创建第三个值 (m3),但我不知道如何处理该obj.nodeValue=(obj.nodeValue==m1)?m2:m1;
行。另外,我将如何将 html 放入 m1、m2 和 m3 中?特别是粗体标签。谢谢
<script type="text/javascript">
function adMessage() {
delay=10000;
m1='Place your Thanksgiving orders today!';
m2='All orders must be received by November 20th!';
m3='testing';
obj=document.getElementById('orders').firstChild;
obj.nodeValue=(obj.nodeValue==m1)?m2:m1;
setTimeout(function(){adMessage()},delay);
}
if(window.addEventListener){
window.addEventListener('load',adMessage,false);
}
else {
if(window.attachEvent){
window.attachEvent('onload',adMessage);
}
}
</script>
<p id="orders">Place your Thanksgiving orders today!</p>