www.webdeveloper.com
Results 1 to 15 of 15

Thread: Cant get targets to work in a pop-up menu.

  1. #1
    Join Date
    Dec 2002
    Posts
    11

    Cant get targets to work in a pop-up menu.

    Alright, Im using a 3 part frame set up to display a download section. The top is the title with a Javascript menubar acrost the top (no problems with this). The left frame under the top frame is my menu. It has 5 pop-up menus each for a different catergory. Now, my problem is getting the options in the menus to open in the third frame on the right (named mainFrame).

    <form name="form1">
    <select name="creator" onChange="MM_jumpMenu('parent',this,0)">
    <option value="#Top" selected>Select One</option>
    <option value="jassur.htm" target="mainFrame">Jassur</option>
    <option value="xman.htm" target="mainFrame">Xman</option>
    <option value="bball.htm" target="mainFrame>bball_1523</option>
    </select>
    </form>

    Even with a target in there, the link opens into a new page. Anyone know how I can fix this?

  2. #2
    Join Date
    Dec 2002
    Location
    Sarasota, FL
    Posts
    63
    Target is not a valid attribute for the OPTION tag. You will need to modify the function that gets called (MM_jumpMenu) to set the location in the correct frame.

  3. #3
    Join Date
    Dec 2002
    Posts
    11
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;

    So I need to change this to what? (the frame i want it in is called mainFrame)

  4. #4
    Join Date
    Dec 2002
    Location
    Sarasota, FL
    Posts
    63
    Ok, having the code for the function clarifies it a little bit. So the first argument to that function is supposed to be the window you want to target, no changes needed to the function itself. Simply change the call to it on your onchange attribute to read:

    MM_jumpMenu('mainFrame',this,0)

    And you should be all set. The target was pointing to "parent" which means the links should have been opening in the main window, nuking your frameset in the process. Now they should go to the right place.

  5. #5
    Join Date
    Dec 2002
    Posts
    11
    function MM_jumpMenu('mainFrame',this,0){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;

    So it needs to be that?

    BTW, Thanx a lot bro!

  6. #6
    Join Date
    Dec 2002
    Location
    Sarasota, FL
    Posts
    63
    Oh, no no.. in your form the call to the function needs to be changed (my assumption was wrong in my first reply). So your form would start like...

    <form name="form1">
    <select name="creator" onChange="MM_jumpMenu('mainFrame',this,0)">

    Nothing needs to be changed from the original function itself.

  7. #7
    Join Date
    Dec 2002
    Posts
    11
    Ah, I see. Sorry bout seeming like a moron. I DO know what Im doing most of the time. (but then again I normally spend time burried in pixels) {{GRAPHIX DESIGN}}

    Thanx a million!

  8. #8
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    If you try to do this with JavaScript you will only find that it doesn't work for a good number of users. This method will always work:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Drop Down With Frames</title>
    <form name="form1" action="form1.pl" target="mainFrame">
    <div>
    <select name="creator">
    <option value="#Top" selected>Select One</option>
    <option value="jassur.htm">Jassur</option>
    <option value="xman.htm">Xman</option>
    <option value="bball.htm">bball_1523</option>
    </select>
    <input type="submit">
    </div>
    </form>


    And then get something like the following up and running and named something like "form1.pl":


    #!usr/local/bin/perl
    use CGI qw(redirect param);
    print redirect param 'creator';
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  9. #9
    Join Date
    Dec 2002
    Posts
    11
    Okay, I understand EVERYTHING in the first part of your post, seeing as how it came from ...Dreamweaver?

    But the second part pretty much went WAY over my head.

    <form name="form1">
    <select name="creator" onChange="MM_jumpMenu('mainFrame',this,0)">
    <option value="#Top" selected>Select One</option>
    <option value="jassur.htm">Jassur</option>
    <option value="xman.htm">Xman</option>
    <option value="bball.htm">bball_1523</option>
    </select>
    </form>

    My page dosent do anything now. Do I need to change something else?

  10. #10
    Join Date
    Dec 2002
    Posts
    11
    I think that we are all off the mark... I should have known..

    How bout this....

    <form name="form1">
    <select name="creator" onChange="MM_jumpMenu('parent.frames[\'mainFrame\']',this,0)">
    <option value="#Top" selected>Select One</option>
    <option value="jassur.htm">Jassur</option>
    <option value="xman.htm">Xman</option>
    <option value="bball.htm">bball_1523</option>
    </select>
    </form>

  11. #11
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    It won't work on my browser.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  12. #12
    Join Date
    Dec 2002
    Posts
    11
    And you are using?

  13. #13
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Opera 6.05. But like 12% of users I'm not using JavaScript. I can't stand people resizing my windows.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  14. #14
    Join Date
    Dec 2002
    Posts
    11
    Haha, well, thanks for the help anyways!

  15. #15
    Join Date
    Nov 2002
    Posts
    984
    Originally posted by UltimateRCT
    Haha, well, thanks for the help anyways!
    Why do you deliberately want to break your pages for users without JavaScript when you don't need to?
    // Stefan Huszics

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles