我在JavaScript兼容性方面存在一些问题。我使用下面的代码来清除文本框模糊数据,当点击该文本框。此代码在IE浏览器3.6 &工作正常,但在Firefox 4不支持。一些错误是有错误控制台,如clearTextFrom is not defined
& clearTextTo is not define
。请检查以下代码&建议我如何在FF4上运行此代码。Firefox 4.0中的JavaScript问题
function clearTextFrom() {
if(document.getElementById("size_from").value=="From Year")
document.getElementById("size_from").value="";
}
function clearTextTo() {
if(document.getElementById("size_to").value=="To Year")
document.getElementById("size_to").value="";
}
等待您的快速响应。
由于提前 TANU
编辑:
<div class="yearsearch">
<input type='text' style='width: 60px;' name='size_from' maxlength='4' size='17' id='size_from' onfocus='clearTextFrom();' onkeyup="validNumbers(document.getElementById('size_from')); sync();"/>
<input type='text' style='width: 60px;' name='size_to' maxlength='4' size='17' id='size_to' onfocus='clearTextTo();' onkeyup="validNumbers(document.getElementById('size_to'));"/>
</div>
这是我用来调用这些函数的代码。
请,使代码的代码来了解更多。 – 2011-04-19 07:45:47
你可以发布你调用的代码吗?在你的函数之外被提出(这对我来说很好)。 – ZeissS 2011-04-19 07:47:38
抱歉,你的意思是什么。我无法理解。 – Tanu 2011-04-19 07:47:54