java help!!! professional needed...

Discussion in 'JavaScript' started by eric777, Nov 1, 2006.

  1. #1
    hello. like ALI G would say: "much respek yo!" webmasters rule.. now - here's my challenge: i'm trying to combine the functionality of 2 similar javascript codes. it's not working!!!! what am i doing wrong??? please please help!!! thanks.. :eek:)

    code for drop down menu
    <FORM name=jumpy><SPAN style="FONT-SIZE: 2px; FONT-FAMILY: Arial">
    <SELECT style="FONT: 10pt Arial; BACKGROUND-COLOR: #ffffd2" onchange=gone() size=1 name=example SELECT>
    <OPTION value=http://www.yahoo.com selected>example 1</OPTION>
    <OPTION value=http://www.msn.com>example 2</OPTION>
    <OPTION value=http://www.bbc.com>example 3</OPTION></SELECT>

    <SPAN style="FONT-SIZE: 5px; FONT-FAMILY: Arial"><BR><BR></FORM>
    <SCRIPT type=text/javascript>
    var displaymode=0
    var iframecode='<iframe id="external" style="width:783;height:383px" src=http://go2xvideos.com/page201.htm></iframe>'

    if (displaymode==0)
    document.write(iframecode)

    function gone(){
    var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
    if (document.getElementById&&displaymode==0)
    document.getElementById("external").src=selectedurl
    else if (document.all&&displaymode==0)
    document.all.external.src=selectedurl
    else{
    if (!window.win2||win2.closed)
    win2=window.open(selectedurl)

    else{
    win2.location=selectedurl
    win2.focus()
    }
    }
    }
    //-->
    </SCRIPT>

    </body>
    </html>


    code for text below drop down menu

    <form name="form1">
    <select name="select1" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')">
    <option selected value="http://www.yahoo.com">example 1</option>
    <option value="http://msn.com">example 2</option>
    <option value="http://bbc.com">example 3</option>
    </select>

    <br>
    <span id="textcontainer1" align="left" style="font:italic 13px Arial">
    </span>
    </form>

    <!--IMPORTANT: Below script should always follow all of your HTML codes above, and never proceed them-->
    <!--To be safe, just add below script at the end of your page-->

    <script type="text/javascript">

    /***********************************************
    * Drop down menu w/ description- © Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for use
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    //1) CUSTOMIZE TEXT DESCRIPTIONS FOR LINKS ABOVE
    var thetext1=new Array()
    thetext1[0]="text displayed here for example 1 above"
    thetext1[1]="text displayed here for example 2 above"
    thetext1[2]="text displayed here for example 3 above"

    // Now, see 2) below for final customization step

    function displaydesc(which, descriptionarray, container){
    if (document.getElementById)
    document.getElementById(container).innerHTML=descriptionarra y[which.selectedIndex]
    }

    function jumptolink(what){
    var selectedopt=what.options[what.selectedIndex]
    if (document.getElementById && selectedopt.getAttribute("target")=="newwin")
    window.open(selectedopt.value)
    else
    window.location=selectedopt.value
    }

    //2) Call function displaydesc() for each drop down menu you have on the page
    // This function displays the initial description for the selected menu item
    // displaydesc(name of select menu, name of corresponding text array, ID of SPAN container tag):
    // Important: Remove the calls not in use (ie: 2nd line below if there's only 1 menu on your page)

    displaydesc(document.form1.select1, thetext1, 'textcontainer1')

    </script>
    [/SIZE]
     
    eric777, Nov 1, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Mind explaining what you're trying to do and what error you get?
     
    nico_swd, Nov 1, 2006 IP