2011-05-09 97 views
0

我需要一点帮助。我想弄清楚如何使用数组。有8个不同的区域使用时间戳。每个区域的ID是TS-TS8。我需要它,当我更新时间时,它会更新所有区域。任何人都可以帮我解决这个问题吗?时间戳阵列

<script type="text/javascript"> 
function setEffectiveDate() { 
    document.getElementById("ts").effdte.value = '<?php echo("As of: " . date('d F, Y') . " 12:10 AM ET") ?>'; 
    for (i=2; i<=6; i++) 
     document.getElementById("ts" + i).effdte.value = '<?php echo("As of: " . date('d F, Y') . " 12:10 AM ET") ?>'; 
} 
</script> 

感谢您的支持! setEffectiveDate被称为<body onLoad="setEffectiveDate();">和 “effdte” 如下

<form name="ts" id="ts"> 
    <table cellpadding="0" cellspacing="0" border="0" width="650" id="effective_date"> 
    <tr> 
    <td><input id="effdte" type="text" name="effdte" value="" readonly="readonly" /></td> 
    </tr> 
    </table> 
</form> 

谢谢!

回答

0

你让服务器端与客户端脚本混淆。如果你解析这个函数,PHP会添加页面加载到函数中的时间戳。因此,每次调用此函数时都会加载相同的时间戳。

我不知道你正在尝试加载,我想有这个代码所缺少(FE你的页面的一部分被调用setEffectiveDate()函数的一部分?

而且我不知道在你的document.getElementByID()部分有什么'effdte'..