Thread: JavaScript

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    UK
    Posts
    82
    Rep Power
    12

    JavaScript


    Hi,

    Can someone please tell me how to make a javascript that will popup a input box when the user clicks on a image/button.

    What i am trying to do is make a box pop on screen where the user types in something and the javascript adds html tags like bold etc.

    EX:

    user clicks button, types in 'hello'
    in the text field on the page the javascript put <b>hello</b>
    etc.

    thank you
  2. #2
  3. Wiser? Not exactly.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    5,952
    Rep Power
    4033
    For a simple one:

    Code:
    function bold(frm){
          var txt=window.prompt('Enter the text to bold','');
          frm.HTMLCode.value+='<b>'+txt+'</b>';
    }
    
    <input type="button" value="B" onclick="bold(this.form);">

IMN logo majestic logo threadwatch logo seochat tools logo