Web Analytics Made Easy -
StatCounter sorry if i sound stupid but... - CodingForum

Announcement

Collapse
No announcement yet.

sorry if i sound stupid but...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • sorry if i sound stupid but...

    can anyone help me?

    i have a links page with 2 frames. in the left frame i have the buttons for different categories, and when you click on one, it brings up a drop-down menu in the right frame. when you choose a site and click the go button, it opens up a whole new page with that site on. all very good so far but...
    when you go back to my page, the left frame is fine, but the right frame has nothing but the word
    [object]
    in it. when you refresh it, that page also goes to the link you chose. how can i fix it so that my page still shows the drop-down menu?

    please help because it's bugging the hell outta me!!

    ps - if you need to see it for yourself the address is

    i'm still working on it, so only the 'search engines' work (or not!!) at the moment

    thankyou

  • #2
    What does the code look like in the page with the search engine menu?

    Comment


    • #3
      What does the code look like in the page with the search engine menu?

      Comment


      • #4
        it's a bit of a bodge i know - i just sort of tried everything till i got closest to the result i want




        <center><form name="d531">
        <p><select name="d562" size="1">
        <option selected value=javascript:window.open("http://www.google.com")>Google</option>
        <option value=javascript:window.open("http://www.yahoo.co.uk")>Yahoo</option>
        <option value=javascript:window.open("http://uk.altavista.com")>Altavista</option>
        <option value=javascript:window.open("http://www.ask.co.uk")>Ask Jeeves</option>
        <option value=javascript:window.open("http://www.lycos.co.uk")>Lycos</option>
        <option value=javascript:window.open("http://astalavista.box.sk")>Astalavista</option>
        <option value=javascript:window.open("http://www.excite.com")>Excite</option>
        </select>
        <input type="button" value="Go"
        onClick="location=document.d531.d562.options[document.d531.d562.selectedIndex].value"></p>
        </form></center>

        Comment


        • #5
          simple fix here

          You are setting the page location to a window.open command.

          I guess javascript sees this as and [object] so that is why you get crap.

          I am guessing what you want is to just open new windows from the <select> menu.

          so.

          Instead of location=window.open("http://www.yahoo.co.uk");

          you just want change the button to do something like:

          Code:
          <input type="button" value="Go" 
          onClick="eval(document.d531.d562.options[document.d531.d562.selectedIndex].value);">
          Also you then can get rid of the "javascript:" part. Which makes me kind of edgy when thinking about how exactly that will be evaluated in the future.

          Code:
          <option value='window.open("http://uk.altavista.com")'>Altavista</option>
          And finally, if you want your frame to become that location and not popup a new window: notice the window.open is no longer there just the url.

          location = URL;

          is the normal way to run that command

          Code:
          <option value="http://uk.altavista.com">Altavista</option>
          <input type="button" value="Go"                          onClick="location=document.d531.d562.options[document.d531.d562.selectedIndex].value">

          -S. Bob

          ps. I would update your form name to something like 'frmLinkSelector' and your button to something like 'btnGo' d531 and d652 are not good names at all. :\
          Last edited by Soldier Bob; Jul 11, 2002, 04:43 PM.

          Comment


          • #6
            Make the URLs the value of each select option, and pass the form to a function that pulls out the value. I'd say rethink your entire navigation scheme however. You really don't want to send your user elsewhere, and give him the chance of not coming back. Since you're using frames, keep the search engine locations in your own frameset. That way you can put controls on your page that specify what pages are going to appear in what frames when they return. You can't over ride the back button, but if you give an obvious in-page alternative, they'll probably use that. This works in IE and NN6, don't know about nn4. (Don't much care, either, but that's just arrogant elitism on my part).


            <html>
            <head>
            <script language="javascript">

            function goLoc(form){
            choice=form.choose[form.choose.selectedIndex].value;
            newWin=window.open(choice);
            }
            </script>

            </head>
            <body>

            <center><form id="frm">
            <p><select id="choose" size="1">
            <option selected value="http://www.google.com">Google</option>
            <option value="http://www.yahoo.co.uk">Yahoo</option>
            <option value="http://uk.altavista.com">Altavista</option>
            <option value="http://www.ask.co.uk">Ask Jeeves</option>
            <option value="http://www.lycos.co.uk">Lycos</option>
            <option value="http://astalavista.box.sk">Astalavista</option>
            <option value="http://www.excite.com">Excite</option>
            </select>
            <input type="button" value="Go" onClick="goLoc(this.form)";></p>
            </form></center>

            </body>
            </html>

            Comment


            • #7
              brilliant!

              thankyou very much - it's fixed now

              Comment

              Working...
              X