日期:2014-05-16  浏览次数:20424 次

________-----javascript的問題
方法1:
<script   language= "javascript ">
function   xxx()
{
    //var   txt1=document.getElementById( "txtAttachment ");
    alert( "xx ");
    //txt1.value= "xxx ";
    //lbox.options[lbox.selectedIndex].value=document.getElementById( "file1 ").FileName;
}
</script>

<input   name= "btnAddAttachment "   type= "button "   id= "btnAddAttachment "   onclick= "xxx() "   value= "添加 "   />

方法2:

<input   name= "btnAddAttachment "   type= "button "   id= "btnAddAttachment "   onclick= "alert( 'xx ') "   value= "添加 "   />

为什么方法1不可以,2就可以,1错在哪?

谢谢!


------解决方案--------------------
我试过可以啊
------解决方案--------------------
说说怎么不可以了?

------解决方案--------------------
<input name= "test " type= "button " id= "test " onclick= "test " value= "測試 " />
改为

<input name= "test " type= "button " id= "test " onclick= "test() " value= "測試 " />

------解决方案--------------------
可以运行啊
------解决方案--------------------
你加"()"这个的时候IE没报错吗?

应该是你的输入法的问题吧.

-------------------------

一定要加 "() "嗎?

这个我个人认为应该得加(没去找过依据),而且必须得加
------解决方案--------------------
()要加的,要注意全角和半角