document.forms(...)txt IdentifierXml [英] document.forms(...) txt IdentifierXml
本文介绍了document.forms(...)txt IdentifierXml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将txtIdentifierXml作为隐藏变量.
< INPUT id = " style = "
type = " size = " 1" name = txtIdentifierXml"运行= " >
在我的frmidentifier.aspx.vb中,我编写了javascript.
那是
我 .RegisterClientScriptBlock(" CloseMe_2", < script language ='javascript'>"& _
" & _
" & _
" )
我在
的行出现错误
"
错误是:
document.forms(...).txtIdentifierXml.value '
为null或不是对象
请帮助我
解决方案
最好的办法是,在注册脚本之前查看源代码(html)(如果可以,请注释一下),看看是否看到任何脚本.元素名称,例如txtIdentifierXml.
如果您的表单具有名称,则可以将其直接用作:
< form name ="myform" ...
那么您可以使用:
文档 .myform.txtIdentifierXml
您的商品是隐藏的,在那里您只需要一些棘手的东西,即使用clientID
document.getElementById(''<%= txtIdentifierXml.ClientID%>'').value
我 .RegisterClientScriptBlock(" CloseMe_2", <脚本语言=" javascript'">& _ " & _ " & _ " & _ " )
>
Hi,
I have txtIdentifierXml as hidden variable.
<INPUT id="txtIdentifierXml" style="Z-INDEX: 101; LEFT: 488px; WIDTH: 40px; POSITION: absolute; TOP: 176px; HEIGHT: 32px"
type="hidden" size="1" name="txtIdentifierXml" runat="server">
in my frmidentifier.aspx.vb i wrote javascript.
that is
Me.RegisterClientScriptBlock("CloseMe_2", "<script language='javascript'>" & _
"alert(document.forms[0].txtIdentifierXml.value);" & _
" window.returnValue = document.forms[0].txtIdentifierXml.value;" & _
" </script>")
i get an error at the line of
"alert(document.forms[0].txtIdentifierXml.value);"
error is :
document.forms(...).txtIdentifierXml.value'
is null or not an object
please help me
解决方案
The Best thing would be, view the source(html) before you register the script(comment it if you can) and see if you see any element name like txtIdentifierXml.
If your form has a name, then you can use it directly as:
<form name="myform" ...
then you can use:
document.myform.txtIdentifierXml
A your item is hidden you need little more tricky stuff there, ie to use clientID
document.getElementById(''<%=txtIdentifierXml.ClientID %>'').value
Me.RegisterClientScriptBlock("CloseMe_2", "<script language="'javascript'">" & _ "var hidVal =document.yourformname.getElementById('<%=txtIdentifierXml.ClientID %>').value;" & _ "alert(hidVal);" & _ " window.returnValue = hidVal;" & _ " </script>")
这篇关于document.forms(...)txt IdentifierXml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文