It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

onChange issue

onChange issue

Postby deluxmilkman on Fri Oct 26, 2007 5:56 pm

I have 2 html menu.html and menu2.html,
and would like to swich one another using "onChange" in each form.

function pageCh works first time, but it doesn't 2nd time.
alert("menu2") does not pop up either.




javascript in menu.html
[HTML]

<script language="JavaScript" type="text/JavaScript">
<!--
function pageCh(sectionURL) {

parent.section.location.href = sectionURL;
if(sectionURL == "section02.xml") {
parent.menu.location.href = "menu2.html";
}
}

//-->
</script>

[/HTML]

form in menu.html


[HTML]

<form>
<select onChange="pageCh(this.value)">
<option value="section01.xml" selected>1/option>
<option value="section02.xml">2</option>
</select>
</form>

[/HTML]




javascript in menu2.html

[HTML]

<script language="JavaScript" type="text/JavaScript">
<!--

alert("menu2");

function pageCh(sectionURL) {
alert(sectionURL);
parent.section.location.href = sectionURL;
if(sectionURL == "section01.xml") {
parent.menu.location.href = "menu.html";


}

//-->
</script>

[/HTML]

form in menu2.html

[HTML]

<form>
<select onChange="pageCh(this.value)">
<option value="section02.xml" selected>2</option>
<option value="section01.xml">1</option>
</select>
</form>

[/HTML]


thanks
deluxmilkman
 
Posts: 8
Joined: Wed Sep 26, 2007 3:15 pm

Postby sachav on Fri Nov 09, 2007 5:01 pm

I think you forgot a "}" in the JS code of menu2.html here:
<script language="JavaScript" type="text/JavaScript">
<!--

alert("menu2");

function pageCh(sectionURL) {
alert(sectionURL);
parent.section.location.href = sectionURL;
if(sectionURL == "section01.xml") {
parent.menu.location.href = "menu.html";
} // HERE

}

//-->
</script>
sachav
 
Posts: 32
Joined: Sat Mar 03, 2007 3:40 pm


Who is online

Users browsing this forum: No registered users and 7 guests