Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts

    anyone can modify this script?

    anyone can modify the following script no to show in the text field but in a table
    Code:
    //get scripts from javascriptkit.com
    <center>
    <form name="combowithtext">
    <select name="example" size="1" onChange="showtext()">
    <option value="http://www.cnet.com">Cnet</option>
    <option value="http://www.cnn.com">CNN</option>
    <option value="http://www.geocities.com">Geocities</option>
    </select>
    <input type="button" value="Go!"
    onClick="gothere()"><br>
    <textarea rows=5 cols=21 wrap="virtual" name="text"></textarea>
    <script language="javascript">
    <!--
    
    var shortcut=document.combowithtext
    var descriptions=new Array()
    
    //extend this list if neccessary to accomodate more selections
    descriptions[0]="Click here for Cnet, the primer technology site on the net!"
    descriptions[1]="Click here for CNN, one of the best sources online to get your news."
    descriptions[2]="Click here for Geocities, and receive 10 megs of free web space."
    
    
    shortcut.text.value=descriptions[shortcut.example.selectedIndex]
    function gothere(){
    location=shortcut.example.options[shortcut.example.selectedIndex].value
    }
    
    function showtext(){
    shortcut.text.value=descriptions[shortcut.example.selectedIndex]
    }
    //-->
    </script>
    
    </form>
    </center>
    flying dagger

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Create your table and give an ID to the data cell you wish to enter the chosen text... and then change this line:

    shortcut.text.value=descriptions[shortcut.....

    To point to the data cell using:

    document.getElementById('ID_OF_DATA_CELL').innerHTML = descriptions[shortcut.....

    .....Willy


  •  

    Posting Permissions

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