日期:2014-05-18  浏览次数:20402 次

javascript 缺少对象
function   fun(btnid)
{
document.Form1.Text1.value=document.getElementById(btnid).name
}
<body   MS_POSITIONING= "GridLayout ">
<form   id= "Form1 "   method= "post "   runat= "server ">
&lt; <INPUT   id= "Button1 "   style= "Z-INDEX:   103;   LEFT:   152px;   POSITION:   absolute;   TOP:   192px "   type= "button "
value= "Button "   onclick= "fun(Button1) "   name= "Button1 "   runat= "server "> <INPUT   id= "Text1 "   style= "Z-INDEX:   104;   LEFT:   104px;   POSITION:   absolute;   TOP:   144px "   type= "text "
name= "Text1 "   runat= "server "> </form>
</body>

想通过点击button1按钮把其id值做为参数传过去,然后再text1中显示其name,一直提醒   缺少对象,大虾怎么回事呢?

------解决方案--------------------
onclick= "fun( 'Button1 ') "
------解决方案--------------------
onclick= "fun( 'Button1 ') "