SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    repsenting data from textbox in to alertbox

    i want to create a form in which two textboxes must be present one is for name and other is for password and button must be present when i click on that button one alertbox must come displaying name and password

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title>Untitled Document</title>
            <link rel="stylesheet" type="text/css" media="screen" />
            <style type="text/css"></style>
            <script type="text/javascript">
                function doSomething() {
                    var u = document.getElementById('txtUsername');
                    var p = document.getElementById('txtPassword');
    
                    alert('Username: ' + u.value + '\nPassword: ' + p.value);
                }
            </script>
        </head>
        <body>
            
            <label for="txtUsername">Username: </label><input type="text" id="txtUsername" /><br />
            <label for="txtPassword">Password: </label><input type="password" id="txtPassword" /><br /><br />
            <input type="button" value="Go" onclick="doSomething();" />
    
        </body>
    </html>



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •