Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript HTML XHTML WebForms , +
There is an XHTML form including 3 text boxes and a submit button.
When the submit button is pressed the data in the text boxes must be submitted and they should identified by JavaScript and should pass those variable values to an alert!
 
How could I able to do that!
Posted 29-Oct-11 5:52am
Edited 29-Oct-11 5:53am
v2
Comments
Uday P.Singh at 29-Oct-11 12:09pm
   
you could have googled it first.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

When you say submit, you imply you are sending the values back to the server. If you want to use JavaScript to get the values out form fields and present them in an alert, this is what you might do:
 
<html>
<script>
function showValues() 
{
    alert(document.getElementById('txtMgs').value);
}
</script>
 
<body><form>
 
<input type="text" id="txtMsg" />
<input type="button" value="click me!" id="btnRun" onclick="showValues();" />
 
</form></body></html>
  Permalink  
Comments
Chiranthaka Sampath at 29-Oct-11 11:08am
   
Thanks a lot!
Uday P.Singh at 29-Oct-11 12:09pm
   
simple 5!

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

  Print Answers RSS
0 OriginalGriff 6,769
1 Sergey Alexandrovich Kryukov 6,338
2 DamithSL 5,408
3 Manas Bhardwaj 4,816
4 Maciej Los 4,195


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 29 Oct 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100