SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Inpu box via JS

Hybrid View

  1. #1
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking Inpu box via JS

    Hi guys!

    how do you call an input dialog box via JS? im trying to accomplish a simple example where when i click a link, it'll launch a input dialog, where i input a sort of text, and echo it (alert()).

    any sample or link?
    If you won't dress like the
    Victoria Secret girls,
    don't expect us to act like soap opera guys.

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Lance,

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Template</title>
    <meta name='author' content='Author'>
    <meta name='description' content='Description'>
    <meta name='keywords' content='Keywords'>
    <link rel='stylesheet' type='text/css' href=''>
    <style type='text/css'>
    .btn {
      border-bottom:1px dotted #000;
      cursor:pointer;
    }
    </style>
    <script type='text/javascript' src=''></script>
    <script type='text/javascript'>
    window.onload = function()
    {
      document.getElementById('btn1').onclick = btnOnClick;
    };
    function btnOnClick()
    {
      var s = prompt('Enter something', 'something');
      alert(s);
    }
    </script>
    </head>
    <body>
    
    <p>Click <span id='btn1' class='btn'>me</span>.</p>
    
    </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
  •