select case

K

Keon

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("document.getElementById('myIframe').src
='test.htm'",0);
case 2: setTimeout("document.getElementById('myIframe').src
='test2.htm'",0);
}
But the result is always that test2.html is placed in my iframe

greeting
Koen
 
Y

Yann-Erwan Perio

Keon said:
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("document.getElementById('myIframe').src
='test.htm'",0);

break; // ;-)
 
H

Hal Rosser

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("document.getElementById('myIframe').src
='test.htm'",0);
case 2: setTimeout("document.getElementById('myIframe').src
='test2.htm'",0);
}
But the result is always that test2.html is placed in my iframe

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top