/    Sign up×
Community /Pin to ProfileBookmark

Hi people.

I waswondering if someone could please help.

This is the site im working on [url]http://www.odysseyexperience.co.uk/[/url]

What i am trying to achieve is when a user selects arabia from the first drop down it redirects to a new web site, but if they select any other option it updates the second menu which then goes to the relavent page, is that possible ?

Thanks

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsOct 16.2004 — [code=php]

<html>

<head>
<title></title>
</head>

<body>
<select id="Country" name="Country" size="1" style="width:100px" onclick="javascript:getCountry();" >
<option >Country</option>
</select>
<select id="Region" name="Region" size="1" style="width:100px" onclick="javascript:getRegion();" >
<option >Region</option>
</select>

<script language="JavaScript" type="text/javascript">
<!--
CountryAry=new Array(['England','EnglandAry'],['Scotland','http://www.vicsjavascripts.org.uk'] )
EnglandAry=new Array(['London','http://www.vicsjavascripts.org.uk'],['Portsmouth','http://www.js-examples.com'])


function gEBId(id){
return document.getElementById(id)
}

for (i=0;i<CountryAry.length;i++){
gEBId('Country').options[i+1]=new Option(CountryAry[i][0],CountryAry[i][1],true,true)
}
gEBId('Country').selectedIndex=0;

function getCountry(){
if (gEBId('Country').selectedIndex<1){ return };
CountryValue=gEBId('Country').options(gEBId('Country').selectedIndex).value;
if (CountryValue.substring(0,4)=='http'){
alert('Country remove this line and the // from line below');
window.top.location=CountryValue;
}
else {
showRegion()
}
}

function showRegion(){
ThisRegionAry=new Array;
ThisRegionAry=eval(CountryValue);
for (i=0;i<ThisRegionAry.length;i++){
gEBId('Region').options[i+1]=new Option(ThisRegionAry[i][0],ThisRegionAry[i][1],true,true)
}
gEBId('Region').selectedIndex=0;
}

function getRegion(){
if (gEBId('Region').selectedIndex<1){ return };
RegionValue=gEBId('Region').options(gEBId('Region').selectedIndex).value;
if (RegionValue.substring(0,4)=='http'){
alert('Region - remove this line and the // from line below');
// window.top.location=RegionValue;
}
}



//-->
</script>
</body>

</html>
[/code]
Copy linkTweet thisAlerts:
@Andy_WilliamsauthorOct 16.2004 — Wow that excellent, your a genius!

Thanks so much for you help.

Andy
×

Success!

Help @Andy_Williams spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...