select case

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

    select case

    Hoi

    Is there a way to use a select case in a javascript?

    I already tried it with switch
    intHulp = 1;
    switch (intHulp)
    {
    case 1: setTimeout("doc ument.getElemen tById('myIframe ').src
    ='test.htm'",0) ;
    case 2: setTimeout("doc ument.getElemen tById('myIframe ').src
    ='test2.htm'",0 );
    }
    But the result is always that test2.html is placed in my iframe

    greeting
    Koen


  • Yann-Erwan Perio

    #2
    Re: select case

    Keon wrote:
    [color=blue]
    > Is there a way to use a select case in a javascript?
    >
    > I already tried it with switch
    > intHulp = 1;
    > switch (intHulp)
    > {
    > case 1: setTimeout("doc ument.getElemen tById('myIframe ').src
    > ='test.htm'",0) ;[/color]

    break; // ;-)
    [color=blue]
    > case 2: setTimeout("doc ument.getElemen tById('myIframe ').src
    > ='test2.htm'",0 );
    > }
    > But the result is always that test2.html is placed in my iframe[/color]

    Comment

    • Keon

      #3
      Re: select case


      "Yann-Erwan Perio" <y-e.perio@em-lyon.com> wrote in message
      news:41a4f4b4$0 $22430$626a14ce @news.free.fr.. .[color=blue]
      > Keon wrote:
      >[color=green]
      > > Is there a way to use a select case in a javascript?
      > >
      > > I already tried it with switch
      > > intHulp = 1;
      > > switch (intHulp)
      > > {
      > > case 1: setTimeout("doc ument.getElemen tById('myIframe ').src
      > > ='test.htm'",0) ;[/color]
      >
      > break; // ;-)
      >[color=green]
      > > case 2: setTimeout("doc ument.getElemen tById('myIframe ').src
      > > ='test2.htm'",0 );
      > > }
      > > But the result is always that test2.html is placed in my iframe[/color]
      >[/color]
      indeed stupid of me

      thanks


      Comment

      • Phillip Parr

        #4
        Re: select case

        aren't you forgetting break; ?

        Phil

        "Keon" <jansen.koen@te lenet.be> wrote in message
        news:Gt6pd.3452 9$w66.1710177@p hobos.telenet-ops.be...[color=blue]
        > Hoi
        >
        > Is there a way to use a select case in a javascript?
        >
        > I already tried it with switch
        > intHulp = 1;
        > switch (intHulp)
        > {
        > case 1: setTimeout("doc ument.getElemen tById('myIframe ').src
        > ='test.htm'",0) ;
        > case 2: setTimeout("doc ument.getElemen tById('myIframe ').src
        > ='test2.htm'",0 );
        > }
        > But the result is always that test2.html is placed in my iframe
        >
        > greeting
        > Koen
        >
        >[/color]


        Comment

        • Hal Rosser

          #5
          Re: select case

          > Is there a way to use a select case in a javascript?[color=blue]
          >
          > I already tried it with switch
          > intHulp = 1;
          > switch (intHulp)
          > {
          > case 1: setTimeout("doc ument.getElemen tById('myIframe ').src
          > ='test.htm'",0) ;
          > case 2: setTimeout("doc ument.getElemen tById('myIframe ').src
          > ='test2.htm'",0 );
          > }
          > But the result is always that test2.html is placed in my iframe[/color]

          VB's "Select Case" doesn't need the "break;" statement - but javascript's
          switch statement does need the break statement in each "case" block -
          otherwise they all get executed from the "true" part on down through the
          rest of the curly-braced section.



          ---
          Outgoing mail is certified Virus Free.
          Checked by AVG anti-virus system (http://www.grisoft.com).
          Version: 6.0.799 / Virus Database: 543 - Release Date: 11/19/2004


          Comment

          Working...