Click here to Skip to main content
16,019,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I really dont know how to ask this. but can anyone tell me how to do this?

example..

textbox.TEXT = "1,2,3" user inputted..


HTML:
XML
<script>

                 function myFunction() {
                    
                     var r = confirm("Numbers: " + textbox.TEXT );
                     if (r == true) {
                        document.getElementById('<%=hdnsubmit.ClientID%>').value = r;

                     } else {
                       document.getElementById('<%=hdnsubmit.ClientID%>').value = r;

                     }

                 }
</script>



so that it'll show that, "Numbers: 1,2,3 "
Posted
Comments
Tushar sangani 10-Dec-14 1:00am    
Do You Mean Remove A comm Between the text?
NekoNao 10-Dec-14 1:08am    
no. but to add the value of the label on the javascript. something like that. so that it will show a pop-up with "Numbers: 1,2,3"
Ishpreet Kaur 10-Dec-14 1:04am    
Right now, what is displaying? What is output with the above code?
Ishpreet Kaur 10-Dec-14 1:05am    
According to your logic, it will display value true or false on '<%=hdnsubmit.ClientID%>'
NekoNao 10-Dec-14 1:07am    
yes.that part is working.what i want is to show the values of the label on this part var r = confirm("Numbers: " + textbox.TEXT );

Question seems somewhat unclear,but i think you need to prompt confirmation to user for the input and store if he agrees or not inside hidden field. If so,here is the modified code. Let me know if you still need some help here.
C#
<script>
function myFunction() {
 var Txt = document.getElementById("textbox").value;
 var r=confirm("Numbers: " + Txt);
 document.getElementById('<%=hdnsubmit.ClientID%>').value=r; 
}
</script>

Regards..
 
Share this answer
 
v3
If you want to show values in '<%=hdnsubmit.ClientID%>'

Then try as following:

document.getElementById('<%=hdnsubmit.ClientID%>').value = textbox.TEXT;
 
Share this answer
 
XML
<script>

                 function myFunction() {

                     var r = confirm("Numbers: " + $('#<%=textbox.ClientID%>').val() );
                     if (r == true) {
                        document.getElementById('<%=hdnsubmit.ClientID%>').value = "Numbers: " + $('#<%=textbox.ClientID%>').val();

                     } else {
                       document.getElementById('<%=hdnsubmit.ClientID%>').value = r;

                     }

                 }
</script>
 
Share this answer
 
v3
hi,

if you want to take input value form popup window use prompt instead of confirm
try this

XML
<script>

                 function myFunction() {

                     var r = prompt("Numbers: " , textbox.TEXT );
                     if (r == true) {
                        document.getElementById('<%=hdnsubmit.ClientID%>').value = r;

                     } else {
                       document.getElementById('<%=hdnsubmit.ClientID%>').value = r;

                     }

                 }
</script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900