从Javascript用户控件中读取页面控制值 [英] Read Page Control Values from Javascript User Control
问题描述
如何从javascript
用户控件中读取html输入控件的值?
aspx页面包含尝试的用户控件从aspx页面中的
html输入控件中读取值。
例如:
In在aspx页面中,控件定义为:
< input id =" txtTMOStart" RUNAT = QUOT;服务器"名称= QUOT; txtTMOStart" type =" TEXT"
size =" 30"值= QUOT;试验"的EnableViewState = QUOT;真" />
Javascript用户控件尝试从控件中读取值:
var controlValue = document.aspnetForm.txtTMOStart.value;
然而,即使控件初始化,controlValue也始终为null
的值。
注意:
如果runat =" server"属性从html控件中删除,返回的值
不为null,但是,我无法从代码中读取controla的s值
后面的文件!
有什么想法吗?
谢谢。
How do I read the value of an html input control from inside a javascript
user control?
An aspx page contains a user control that attempts to read a value from an
html input control in the aspx page.
For example:
In the aspx page, the control is defined as:
<input id="txtTMOStart" runat="server" name="txtTMOStart" type="TEXT"
size="30" value="test" enableviewstate="true" />
The Javascript user control attempts to read the value from the control:
var controlValue = document.aspnetForm.txtTMOStart.value;
However, controlValue is always null even thought the control is initialized
with a value.
Note:
If the runat="server" attribute is removed from the html control, the value
returned is not null, however, I can''t read the controla??s value from the code
behind file!
Any ideas?
Thanks.
推荐答案
您是否尝试过document.getElementById(" txtTMOStart")?
-
Eliyahu Goldin,
软件开发人员和放大器;顾问
Microsoft MVP [ASP.NET]
" Roy" < Ro *@discussions.microsoft.com写信息
news:73 *************************** ******* @ microsof t.com ...
Did you try document.getElementById("txtTMOStart" )?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Roy" <Ro*@discussions.microsoft.comwrote in message
news:73**********************************@microsof t.com...
如何从javascript中读取html输入控件的值
用户控件?
aspx页面包含一个用户控件,它试图从aspx页面中的
html输入控件中读取值。
例如:
在aspx页面中,控件定义为:
< input id = QUOT; txtTMOStart" RUNAT = QUOT;服务器"名称= QUOT; txtTMOStart" type =" TEXT"
size =" 30"值= QUOT;试验"的EnableViewState = QUOT;真" />
Javascript用户控件尝试从控件中读取值:
var controlValue = document.aspnetForm.txtTMOStart.value;
然而,即使控制是
How do I read the value of an html input control from inside a javascript
user control?
An aspx page contains a user control that attempts to read a value from an
html input control in the aspx page.
For example:
In the aspx page, the control is defined as:
<input id="txtTMOStart" runat="server" name="txtTMOStart" type="TEXT"
size="30" value="test" enableviewstate="true" />
The Javascript user control attempts to read the value from the control:
var controlValue = document.aspnetForm.txtTMOStart.value;
However, controlValue is always null even thought the control is
初始化
initialized
$,controlValue总是为null b $ b有一个值。
注意:
如果runat =" server"属性从html控件中删除,
with a value.
Note:
If the runat="server" attribute is removed from the html control, the
值
value
返回的
不为null,但是,I无法从
returned is not null, however, I can''t read the control''s value from the
代码中读取控件的价值
code
落后于文件!
有什么想法吗?
谢谢。
behind file!
Any ideas?
Thanks.
是......相同的结果。感谢您的回复。
" Eliyahu Goldin"写道:
Yes...same result. Thanks for your response.
"Eliyahu Goldin" wrote:
您是否尝试过document.getElementById(" txtTMOStart")?
-
Eliyahu Goldin,
软件开发人员&顾问
Microsoft MVP [ASP.NET]
" Roy" < Ro *@discussions.microsoft.com写信息
news:73 *************************** ******* @ microsof t.com ...
Did you try document.getElementById("txtTMOStart" )?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Roy" <Ro*@discussions.microsoft.comwrote in message
news:73**********************************@microsof t.com...
如何从javascript中读取html输入控件的值
用户控件?
aspx页面包含一个用户控件,它试图从aspx页面中的
html输入控件中读取值。
例如:
在aspx页面中,控件定义为:
< input id = QUOT; txtTMOStart" RUNAT = QUOT;服务器"名称= QUOT; txtTMOStart" type =" TEXT"
size =" 30"值= QUOT;试验"的EnableViewState = QUOT;真" />
Javascript用户控件尝试从控件中读取值:
var controlValue = document.aspnetForm.txtTMOStart.value;
然而,即使控制是
How do I read the value of an html input control from inside a javascript
user control?
An aspx page contains a user control that attempts to read a value from an
html input control in the aspx page.
For example:
In the aspx page, the control is defined as:
<input id="txtTMOStart" runat="server" name="txtTMOStart" type="TEXT"
size="30" value="test" enableviewstate="true" />
The Javascript user control attempts to read the value from the control:
var controlValue = document.aspnetForm.txtTMOStart.value;
However, controlValue is always null even thought the control is
初始化
initialized
$,controlValue总是为null b $ b有一个值。
注意:
如果runat =" server"属性从html控件中删除,
with a value.
Note:
If the runat="server" attribute is removed from the html control, the
值
value
返回的
不为null,但是,I无法从
returned is not null, however, I can''t read the control''s value from the
代码中读取控件的价值
code
落后于文件!
有什么想法吗?
谢谢。
behind file!
Any ideas?
Thanks.
输入控件是否在用户控件中?
-
Eliyahu Goldin,
软件开发人员&顾问
Microsoft MVP [ASP.NET]
" Roy" < Ro *@discussions.microsoft.com写信息
新闻:4B *************************** ******* @ microsof t.com ...
Is the input control inside the user control?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Roy" <Ro*@discussions.microsoft.comwrote in message
news:4B**********************************@microsof t.com...
是......相同的结果。感谢您的回复。
" Eliyahu Goldin"写道:
Yes...same result. Thanks for your response.
"Eliyahu Goldin" wrote:
>你试过document.getElementById(" txtTMOStart")吗?
- Eliyahu Goldin,
软件开发人员&顾问
Microsoft MVP [ASP.NET]
" Roy" < Ro *@discussions.microsoft.com写信息
新闻:73 ******************************* *** @ microso ft.com ...
>Did you try document.getElementById("txtTMOStart" )?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Roy" <Ro*@discussions.microsoft.comwrote in message
news:73**********************************@microso ft.com...
如何从
javascript中读取html输入控件的值
用户控件?
一个aspx页面包含一个用户控件,试图从
读取一个值
在aspx页面中
html输入控件。
例如:
在aspx页面中,控件定义为:
< input id =" txtTMOStart" RUNAT = QUOT;服务器"名称= QUOT; txtTMOStart" type =" TEXT"
size =" 30"值= QUOT;试验"的EnableViewState = QUOT;真" />
Javascript用户控件尝试从
控件中读取值:
var controlValue = document.aspnetForm .txtTMOStart.value;
但是,即使控件是
How do I read the value of an html input control from inside a
javascript
user control?
An aspx page contains a user control that attempts to read a value from
an
html input control in the aspx page.
For example:
In the aspx page, the control is defined as:
<input id="txtTMOStart" runat="server" name="txtTMOStart" type="TEXT"
size="30" value="test" enableviewstate="true" />
The Javascript user control attempts to read the value from the
control:
var controlValue = document.aspnetForm.txtTMOStart.value;
However, controlValue is always null even thought the control is
初始化
initialized
带值。
注意:
如果runat =" server"属性从html控件中删除,
with a value.
Note:
If the runat="server" attribute is removed from the html control, the
值
value
返回的
不为null,但是,我不能从
读取控件的值
returned is not null, however, I can''t read the control''s value from
the
代码
code
落后于文件!
有什么想法吗?
谢谢。
behind file!
Any ideas?
Thanks.
这篇关于从Javascript用户控件中读取页面控制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!