ASP.Net对象和Javascript的问题 [英] Problems with ASP.Net object and Javascript
问题描述
我有一个功能:
功能SalaryDisplay(我)
{
var salaryMinLabel = document.getElementById(" ; SalaryMin");
salaryMinLabel.value = 200;
alert("设置salaryMinLabel =" + salaryMinLabel.value之后);
}
我还有一个asp.net对象:
< asp:label id =" SalaryMin" RUNAT = QUOT;服务器" />
呈现:
< span id =" SalaryMin">< / span> >
该函数似乎找到了很好的范围。警告框显示它是
设置为200.但网页从不显示它。
设置span元素是否有问题? />
谢谢,
Tom
I have a function:
function SalaryDisplay(me)
{
var salaryMinLabel = document.getElementById("SalaryMin");
salaryMinLabel.value = 200;
alert("after setting salaryMinLabel = " + salaryMinLabel.value);
}
I also have an asp.net object:
<asp:label id="SalaryMin" runat="server" />
Which renders into:
<span id="SalaryMin"></span>
The function seems to find the span fine. The alert box shows that it is
set to 200. But the web page never shows it.
Is there a problem setting the span element?
Thanks,
Tom
推荐答案
" tshad" < TS ********** @ ftsolutions.com>在消息中写道
news:Ow ****************** @ newssvr21.news.prodigy.c om ...
"tshad" <ts**********@ftsolutions.com> wrote in message
news:Ow******************@newssvr21.news.prodigy.c om...
我有一个功能:
功能SalaryDisplay(我)
{salary salaryMinLabel = document.getElementById(" SalaryMin");
salaryMinLabel.value = 200;
alert(在设置salaryMinLabel =" + salaryMinLabel.value之后);
}
我还有一个asp.net对象:
< asp:label id =" SalaryMin" RUNAT = QUOT;服务器" />
其中呈现:
< span id =" SalaryMin">< / span>
该功能似乎找到跨度好。警告框显示它已设置为200.但是网页从不显示它。
设置span元素是否有问题?
我只是将对象更改为一个asp:textbox,它会在屏幕上呈现输入字段
,这样可以正常工作。
在asp中,您使用标签对象在屏幕上显示(和更改)文本
,它不属于输入类型的字段。
>
有没有办法在Javascript / html中执行此操作?
我只是希望能够在
$ b上显示某些计算的结果用户输入的$ b字段只是一个标签。
谢谢,
Tom
谢谢,
<汤姆
I have a function:
function SalaryDisplay(me)
{
var salaryMinLabel = document.getElementById("SalaryMin");
salaryMinLabel.value = 200;
alert("after setting salaryMinLabel = " + salaryMinLabel.value);
}
I also have an asp.net object:
<asp:label id="SalaryMin" runat="server" />
Which renders into:
<span id="SalaryMin"></span>
The function seems to find the span fine. The alert box shows that it is
set to 200. But the web page never shows it.
Is there a problem setting the span element?
I just change the object to an asp:textbox which renders into an input field
on the screen and this works fine.
In asp, you use a label object to display (and change) text on the screen
that is not part of an input type of field.
Is there a way to do this in Javascript/html?
I just want to be able to display the results of some calculations on a
field that the user inputs as just a label.
Thanks,
Tom
Thanks,
Tom
tshad写道:
tshad wrote:
var salaryMinLabel = document.getElementById(" SalaryMin") ;
salaryMinLabel.value = 200;
< span id =" SalaryMin">< / span>
设置span元素是否有问题?
var salaryMinLabel = document.getElementById("SalaryMin");
salaryMinLabel.value = 200; <span id="SalaryMin"></span> Is there a problem setting the span element?
跨元素没有值。您需要创建一个新的文本节点然后
将它附加到元素以向其添加文本。查看DOM 1规范的JavaScript部分
。 http://w3.org/DOM/
-
David Dorward< http://blog.dorward.me.uk/> < http://dorward.me.uk/>
首页是〜/ .bashrc的位置
Span elements don''t have values. You need to create a new text node then
append it to the element to add text to it. Look at the JavaScript section
of the DOM 1 specification. http://w3.org/DOM/
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
我试过做< lable>同样的事情标签项目和具有相同的
问题。它显示价值已经改变,但似乎没有在屏幕上显示任何内容:
每年补偿:<输入名称= " SalaryMin"类型= QUOT;文本" id =" SalaryMin"
/>& nbsp; /& nbsp;
< span id =" SalaryMax">< / span>
< Label id =" SalaryMin2" for =" SalaryMin">这是一个测试< / Label> />
javascript代码:
功能SalaryDisplay(我)
{
alert(" this.value =" + me.value);
var salaryMinLabel = document.getElementById(" SalaryMin2");
salaryMinLabel。 innerText = 200;
alert(在设置salaryMinLabel =" + salaryMinLabel.value之后);
}
这个好像不起作用。我试图直接这样做
(SalaryMin2.innerText = 200),但那也没办法。
Tom
" tshad" < TS ********** @ ftsolutions.com>在消息中写道
news:VB ****************** @ newssvr21.news.prodigy.c om ...
I tried to do the same thing with the <lable> label item and had the same
problem. It shows that the value was changed, but it didn''t seem to do
anything on the screen:
Yearly Compensation:<input name="SalaryMin" type="text" id="SalaryMin"
/> /
<span id="SalaryMax"></span>
<Label id="SalaryMin2" for="SalaryMin">This is a test</Label> />
The javascript code:
function SalaryDisplay(me)
{
alert("this.value = " + me.value);
var salaryMinLabel = document.getElementById("SalaryMin2");
salaryMinLabel.innerText = 200;
alert("after setting salaryMinLabel = " + salaryMinLabel.value);
}
This doesn''t seem to work. I tried to do it directly
(SalaryMin2.innerText=200), but that didn''t work either.
Tom
"tshad" <ts**********@ftsolutions.com> wrote in message
news:VB******************@newssvr21.news.prodigy.c om...
tshad < TS ********** @ ftsolutions.com>在消息中写道
新闻:Ow ****************** @ newssvr21.news.prodigy.c om ...
"tshad" <ts**********@ftsolutions.com> wrote in message
news:Ow******************@newssvr21.news.prodigy.c om...
我有功能:
功能SalaryDisplay(我)
{salary salaryMinLabel = document.getElementById(" SalaryMin");
salaryMinLabel.value = 200;
alert("在设置salaryMinLabel =" + salaryMinLabel.value之后);
}
我还有一个asp.net对象:
< asp:label id =" SalaryMin" RUNAT = QUOT;服务器" />
其中呈现:
< span id =" SalaryMin">< / span>
该功能似乎找到跨度好。警告框显示它已设置为200.但网页从不显示它。
设置span元素是否有问题?
I have a function:
function SalaryDisplay(me)
{
var salaryMinLabel = document.getElementById("SalaryMin");
salaryMinLabel.value = 200;
alert("after setting salaryMinLabel = " + salaryMinLabel.value);
}
I also have an asp.net object:
<asp:label id="SalaryMin" runat="server" />
Which renders into:
<span id="SalaryMin"></span>
The function seems to find the span fine. The alert box shows that it is
set to 200. But the web page never shows it.
Is there a problem setting the span element?
字段,这很好用。
在asp中,你使用一个标签对象来显示(和更改)屏幕上的文字
不属于输入类型的字段。
有没有办法在Javascript / html中执行此操作?
我只是希望能够在一个
字段上显示一些计算结果,用户输入的只是一个标签。
谢谢,
Tom
I just change the object to an asp:textbox which renders into an input
field on the screen and this works fine.
In asp, you use a label object to display (and change) text on the screen
that is not part of an input type of field.
Is there a way to do this in Javascript/html?
I just want to be able to display the results of some calculations on a
field that the user inputs as just a label.
Thanks,
Tom
谢谢,
Tom
Thanks,
Tom
这篇关于ASP.Net对象和Javascript的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!