470,648 Members | 1,587 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

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="JavaScript">
function openDir( form ) {
var newIndex = form.menu1.selectedIndex;
if ( newIndex == 0 ) {
alert( "Please select a location!" );
} else {
cururl = form.menu1.options[ newIndex ].value;
window.location.assign( cururl );
}
}
</script>

<form name="menu">
<select name="menu1" size="1"
onChange="openDir( this.form )">
<option>1 - 49</option>
<option value="0001/index.html">0001</option>
<option value="0002/index.html">0002</option>
<option value="0003/index.html">0003</option>
</select>
Jul 23 '05 #1
3 878
On Fri, 7 May 2004 01:49:08 -0700, MLewis wrote:

[cut]
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.


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

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

I hope it helps.

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

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).
Jul 23 '05 #2
see the post below this one..

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

:0)

"MLewis" <ml****@mlewis.biz> wrote in message
news:Z3Imc.77708$Jy3.59949@fed1read03...
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="JavaScript">
function openDir( form ) {
var newIndex = form.menu1.selectedIndex;
if ( newIndex == 0 ) {
alert( "Please select a location!" );
} else {
cururl = form.menu1.options[ newIndex ].value;
window.location.assign( cururl );
}
}
</script>

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

Jul 23 '05 #3
On Fri, 7 May 2004 15:18:53 +0200, Dominique wrote:
see the post below this one..

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


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.webDesigner();

"When you have eliminated the impossible, whatever remains,
however improbable, must be the truth." (S.H.)
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jacques Koorts | last post: by
10 posts views Thread by Richard A. DeVenezia | last post: by
5 posts views Thread by Michael C | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.