首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

IE firefox 跟chrome执行js的区别

2012-12-15 
IE firefox 和chrome执行js的区别我写了一个在js中写了个clear()函数,供html中的按钮调用,结果IE能调用,fi

IE firefox 和chrome执行js的区别
我写了一个在js中写了个clear()函数,供html中的按钮调用,结果IE能调用,firefox和chrome都不能调用,代码是这样的:

js代码:
function clear(){
 alert("clear!");
 document.getElementById('inpute').value='';
 }
html中的按钮:
<input type="button"
 class="button" value="清空" name="清空"  onclick="clear();" 
 onmouseover=" change();" /> 
请高手帮忙解决一下,谢谢
[最优解释]
在js里面本身是存在clear()这个方法的,你现在又重新写了一个clear这个方法,那肯定是调用不到你的方法的,你把方法名称改一下就知道了。
[其他解释]
你是不是定义的方法名和浏览器本身的冲突了?
[其他解释]
js代码:
function clear(){
 alert("clear!");
 document.getElementById('inpute').value='';
 }
html中的按钮:
<input type="button"
 class="button" value="清空" id="inpute" name="清空"  onclick="clear();" 
 onmouseover=" change();" /> 
[其他解释]
忘记是哪个浏览器了 应该是不支持getElementById的
[其他解释]
你把你要清空的html控件也贴上来看看
[其他解释]
document.getElementById()这个应该都支持啊,你firefox debug 看看错误信息
[其他解释]

引用:
忘记是哪个浏览器了 应该是不支持getElementById的
我之前写过基本是一样的代码,3大浏览器都执行的。
[其他解释]
引用:
你把你要清空的html控件也贴上来看看

js代码:
 function clear(){
  alert("clear!");
  document.getElementById('inpute').value='';
  }
 html中的代码:
 <input type="button"
  class="button" value="清空" name="清空"  onclick="clear();" 
  onmouseover=" change();" /> 

<input type="text" class="text0" id="inpute"
style="border: solid thin #9BDEFF; width: 180px" name="seachvo.name"
value="${seachvo.name}" />

[其他解释]
引用:
引用:
你把你要清空的html控件也贴上来看看
js代码:
 function clear(){
  alert("clear!");
  document.getElementById('inpute').value='';
  }
 html中的代码:
 <input type="button"
  class="button" va……

能把change()的代码也贴出来吗?
[其他解释]
引用:
引用:引用:
你把你要清空的html控件也贴上来看看
js代码:
 function clear(){
  alert("clear!");
  document.getElementById('inpute').value='';
  }
 html中的代码:
 <input ……

好吧,change的代码是:
function change() {
$(".button").css('cursor', 'pointer');
}

热点排行