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 8 of 8
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trying to change a nice list of items to a drop down box

    This is the section Im working on
    Trying to change a nice list of items to a drop down box see pic



    document.write("<input type=file name=\"addtargeturl\" size=20 style=\"font-size:9pt\">")

    document.write("<input type=button value=\"Insert Image\" onClick=\"addtarget()\" style=\"font-size:9pt\"><br><br></right>")

    document.write("")

    document.write("<a href=\"javascript:targets(\'targets/1.gif\')\"><font size=2 color=003300>4 Ring Black</font></a><br>")


    document.write("<a href=\"javascript:targets(\'targets/1r.gif\')\"><font size=2 color=003300>4 Ring RED</font></a><br>")

    document.write("<a href=\"javascript:targets(\'targets/3.gif\')\"><font size=2 color=003300>Large 5 ring Red</font></a><br>")

    document.write("<a href=\"javascript:targets(\'targets/2.gif\')\"><font size=2 color=003300>6 Ring black</font></a><br>")

    document.write("<a href=\"javascript:targets(\'targets/10ring.gif\')\"><font size=2 color=003300>10 Ring</font></a><br>")

    document.write("<a href=\"javascript:targets(\'targets/10ringred.gif\')\"><font size=2 color=003300>10 Ring Red</font></a><br>")

    document.write("<a href=\"javascript:targets(\'targets/4.gif\')\"><font size=2 color=003300>Green Cross Hairs</font></a><br>")

    document.write("<a href=\"javascript:targets(\'targets/5.gif\')\"><font size=2 color=003300>Red Cross Hairs</font></a><br>")

    document.write("<a href=\"javascript:targets(\'targets/6.gif\')\"><font size=2 color=003300>Window</font></a><br>")






    document.write("</font></center>")
    Attached Thumbnails Attached Thumbnails Trying to change a nice list of items to a drop down box-untitled1.jpg  

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Something like this:
    Code:
    <select name="selectTargets" onchange="if(this.selectedIndex > 0){targets(this.options[this.selectedIndex].value);}">
    <option>Please select a value</option>
    <option value="targets/1.gif">4 Ring Black</option>
    <option value="targets/1r.gif">4 Ring RED</option>
    <option value="targets/3.gif">Large 5 ring Red</option>
    <option value="targets/2.gif">6 Ring black</option>
    <option value="targets/10ring.gif">10 Ring</option>
    <option value="targets/10ringred.gif">10 Ring Red</option>
    <option value="targets/4.gif">Green Cross Hairs</option>
    <option value="targets/5.gif">Red Cross Hairs</option>
    <option value="targets/6.gif">Window</option>
    </select>
    Please note that the <font> tag is deprecated and shouldn't be used. Use CSS instead.

    Hope this helps

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thank you I tried changing early and it donít work still stuck


  • #4
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    didn't work? how? just copy and paste my previous code into your html page where you want it to appear. if you get any error messages, please post them.

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #5
    New Coder
    Join Date
    Aug 2005
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thank you martin

    what I'm tring to do is keep all the work in the js file and it seems the drop down box code works in the html but not the js file
    Last edited by claymaker; 09-17-2005 at 04:42 PM.

  • #6
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Code:
    document.write('<select name="selectTargets" onchange="if(this.selectedIndex > 0){targets(this.options[this.selectedIndex].value);}">\
    <option>Please select a value</option>\
    <option value="targets/1.gif">4 Ring Black</option>\
    <option value="targets/1r.gif">4 Ring RED</option>\
    <option value="targets/3.gif">Large 5 ring Red</option>\
    <option value="targets/2.gif">6 Ring black</option>\
    <option value="targets/10ring.gif">10 Ring</option>\
    <option value="targets/10ringred.gif">10 Ring Red</option>\
    <option value="targets/4.gif">Green Cross Hairs</option>\
    <option value="targets/5.gif">Red Cross Hairs</option>\
    <option value="targets/6.gif">Window</option>\
    </select>');
    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #7
    New Coder
    Join Date
    Aug 2005
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excellent thank you,

    Is there a way to force a return to (Please select a value) in the menu box at the same time maintain the selected option on the screen after an option is selected

  • #8
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Code:
    document.write('<select name="selectTargets" onchange="if(this.selectedIndex > 0){targets(this.options[this.selectedIndex].value);this.selectedIndex=0; }">\
    <option>Please select a value</option>\
    <option value="targets/1.gif">4 Ring Black</option>\
    <option value="targets/1r.gif">4 Ring RED</option>\
    <option value="targets/3.gif">Large 5 ring Red</option>\
    <option value="targets/2.gif">6 Ring black</option>\
    <option value="targets/10ring.gif">10 Ring</option>\
    <option value="targets/10ringred.gif">10 Ring Red</option>\
    <option value="targets/4.gif">Green Cross Hairs</option>\
    <option value="targets/5.gif">Red Cross Hairs</option>\
    <option value="targets/6.gif">Window</option>\
    </select>');
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper


  •  

    Posting Permissions

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