在javascript中获取确认提示中的文本框值 [英] getting textboxes values in confirm prompt in javascript
问题描述
大家好,我想要的是在单个onclientclick事件按钮上输入5个文本框(我的webform包含)中的所有值。可能吗?我可以在onclient点击上获得单个文本框值,但不是所有文本框值。例如。在empid,empname,salary,city如果我输入4,ram,20000 $,加拿大
当我按下输入所有值时应该来确认promt。我写了一小段js代码:
< script type = text / javascript >
{
function callall(){
txtEmpName = document.getElementById(txtEmpName);
value = txtEmpName.value;
确认(价值);
}
}
< / script >
谢谢,我正处于学习阶段,所以请解释你的回答。
,加拿大
当我按下输入所有值应该来确认promt。我写了一小段js代码:
< script type = text / javascript >
{
function callall(){
txtEmpName = document.getElementById(txtEmpName);
value = txtEmpName.value;
确认(价值);
}
}
< / script >
谢谢,我正处于学习阶段,所以请解释一下你的回答。
< blockquote> confirm()事件用于返回布尔值(true或false)。要简单地显示值或消息,您可以使用alert()例如,如果您希望用户在删除记录之前确认您使用此功能,例如:
return confirm(' 您确定要删除此记录吗? ');
在上面的例子中进行这些更改并测试你会看到差异。
< script type = text / javascript>
{
function callall(){
var empText = < span class =code-sdkkeyword> document .getElementById( txtEmpName)。值;
alert(' 您输入了:' + empText);
返回确认(' 你确定你想要发布这个值:' + empText + ' ?');
}
}
< / script>
用作
function callall(){
confirm( document 。 getElementById( txtEmpName)。value + ' \ n' + document.getElementById( txtsal)。value + ' \ n' + document.getElementById( txtcity)。value);
}
}
hi all , what i want is to get all values enterd in 5 textboxes(my webform contains) on single onclientclick event of button. is it possible? i can get a single textbox value on onclient click but not all textboxes values. for eg. in empid,empname,salary,city if i enter 4,ram,20000$,canada
when i press enter all values should come on confirm promt. i write a small piece of js code as:
<script type="text/javascript">
{
function callall() {
txtEmpName = document.getElementById("txtEmpName");
value = txtEmpName.value;
confirm(value);
}
}
</script>
Thanks, i am in learning phase so please explain whatever you answer.
,canada
when i press enter all values should come on confirm promt. i write a small piece of js code as:
<script type="text/javascript"> { function callall() { txtEmpName = document.getElementById("txtEmpName"); value = txtEmpName.value; confirm(value); } } </script>
Thanks, i am in learning phase so please explain whatever you answer.
confirm() event is used to return a boolean value (true or false). To simply display the values or message you may use alert() For example if you want the user to confirm before deleting a record you use this function like:
return confirm('Are you sure you want to delete this record?');
In your example above make these changes and test you will see the difference.
<script type="text/javascript"> { function callall() { var empText = document.getElementById("txtEmpName").value; alert('You entered: ' + empText); return confirm('Are you sure you want to post the vale: ' + empText +'?'); } } </script>
use as
function callall() { confirm(document.getElementById("txtEmpName").value +'\n'+document.getElementById("txtsal").value +'\n'+document.getElementById("txtcity").value); } }
这篇关于在javascript中获取确认提示中的文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!