Arrgh, I know this can work.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MLewis

    #1

    Arrgh, I know this can work.

    OK,

    I am trying to write a drop-down box that changes the page url onClick. So
    far so good, I have the code for that. What I need to know is how do I make
    it load it a different frame? I have about 700 existing HTML pages, and do
    not want to go in and code a menu on all of them, so I want to make a menu
    in a left frame (named left), and have the items load in the main frame
    (named main). Below is the code I have thus far. Any help would be
    appreiciated.

    Thanks in adavnce,

    ML

    <script language="JavaS cript">
    function openDir( form ) {
    var newIndex = form.menu1.sele ctedIndex;
    if ( newIndex == 0 ) {
    alert( "Please select a location!" );
    } else {
    cururl = form.menu1.opti ons[ newIndex ].value;
    window.location .assign( cururl );
    }
    }
    </script>

    <form name="menu">
    <select name="menu1" size="1"
    onChange="openD ir( this.form )">
    <option>1 - 49</option>
    <option value="0001/index.html">000 1</option>
    <option value="0002/index.html">000 2</option>
    <option value="0003/index.html">000 3</option>
    </select>


  • ZER0

    #2
    Re: Arrgh, I know this can work.

    On Fri, 7 May 2004 01:49:08 -0700, MLewis wrote:

    [cut][color=blue]
    > so I want to make a menu
    > in a left frame (named left), and have the items load in the main frame
    > (named main). Below is the code I have thus far. Any help would be
    > appreiciated.[/color]

    <script type="text/javascript">
    function openDir(sel){
    var newIndex=sel.se lectedIndex;
    if (newIndex==0){
    alert("Please select a location!");
    }else{
    top.main.locati on.href=sel.opt ions[newIndex].value;
    }
    }
    </script>

    <form name="menu" action="">
    <select name="menu1 size="1" onchange="openD ir(this)">
    <option selected="true" >1 - 49</option>
    <option value="0001/index.html">000 1</option>
    <option value="0002/index.html">000 2</option>
    <option value="0003/index.html">000 3</option>
    </select>
    </form>

    I hope it helps.

    --
    C'ya,
    ZER0 :: coder.gfxer.web Designer();

    Le donne si dividono in 4 categorie: le suore (non la danno a nessuno);
    le puttane (la danno a tutti); le stronze (la danno a tutti tranne che
    a te); le rompiballe (la danno a te e solo a te).

    Comment

    • Dominique

      #3
      Re: Arrgh, I know this can work.

      see the post below this one..

      submit your form and give it your target..
      instead of doing a navigate or location

      :0)

      "MLewis" <mlewis@mlewis. biz> wrote in message
      news:Z3Imc.7770 8$Jy3.59949@fed 1read03...[color=blue]
      > OK,
      >
      > I am trying to write a drop-down box that changes the page url onClick.[/color]
      So[color=blue]
      > far so good, I have the code for that. What I need to know is how do I[/color]
      make[color=blue]
      > it load it a different frame? I have about 700 existing HTML pages, and[/color]
      do[color=blue]
      > not want to go in and code a menu on all of them, so I want to make a menu
      > in a left frame (named left), and have the items load in the main frame
      > (named main). Below is the code I have thus far. Any help would be
      > appreiciated.
      >
      > Thanks in adavnce,
      >
      > ML
      >
      > <script language="JavaS cript">
      > function openDir( form ) {
      > var newIndex = form.menu1.sele ctedIndex;
      > if ( newIndex == 0 ) {
      > alert( "Please select a location!" );
      > } else {
      > cururl = form.menu1.opti ons[ newIndex ].value;
      > window.location .assign( cururl );
      > }
      > }
      > </script>
      >
      > <form name="menu">
      > <select name="menu1" size="1"
      > onChange="openD ir( this.form )">
      > <option>1 - 49</option>
      > <option value="0001/index.html">000 1</option>
      > <option value="0002/index.html">000 2</option>
      > <option value="0003/index.html">000 3</option>
      > </select>
      >
      >[/color]


      Comment

      • ZER0

        #4
        Re: Arrgh, I know this can work.

        On Fri, 7 May 2004 15:18:53 +0200, Dominique wrote:
        [color=blue]
        > see the post below this one..
        >
        > submit your form and give it your target..
        > instead of doing a navigate or location[/color]

        But in this way you do a POST request. In that case you don't need it. You
        haven't data to pass on the next URL; you change only the current location.

        In addition, with a POST request, if the user refresh the page, there is a
        warning message. Not useful, in that case.

        P.S.
        Sorry for my english, is not very good.. ^_^"


        --
        C'ya,
        ZER0 :: coder.gfxer.web Designer();

        "When you have eliminated the impossible, whatever remains,
        however improbable, must be the truth." (S.H.)

        Comment

        Working...