/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Chain Dropdown working in FF but not IE

Yeah, exactly what I said. I can’t understand why I can’t get this to work in FF but not IE, Here’s the page: [url]http://www.adhome.co.uk/dev/test.php[/url]

I suppose the appropriate bit of code is:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
<script language=”javascript” type=”text/javascript”>
<!–
function changeDiv(id) {
document.getElementById(‘dropdown1’).style.display = “none”;
document.getElementById(‘dropdown2’).style.display = “none”;
document.getElementById(‘dropdown3’).style.display = “none”;
document.getElementById(‘dropdown4’).style.display = “none”;
document.getElementById(‘dropdown5’).style.display = “none”;
document.getElementById(‘dropdown6’).style.display = “none”;
document.getElementById(‘dropdown7’).style.display = “none”;
document.getElementById(‘dropdown8’).style.display = “none”;
document.getElementById(‘dropdown9’).style.display = “none”;
document.getElementById(‘dropdown10’).style.display = “none”;
document.getElementById(‘dropdown11’).style.display = “none”;
document.getElementById(‘dropdown12’).style.display = “none”;
document.getElementById(‘dropdown13’).style.display = “none”;
document.getElementById(‘dropdown14’).style.display = “none”;
document.getElementById(id).style.display = “block”;
}
//–>
</script>
<style type=”text/css”>
<!–
.hidden {
display:none;
}
–>
</style>
</head>

<body>
<form id=”form1″ name=”form1″ method=”post” action=””>
<select name=”region” id=”region” class=”searchwidth” onchange=””>
<option>(Please Select)</option>

<option value=”city” onclick=”changeDiv(‘dropdown1’);”>Glasgow City Centre</option>
<option value=”north” onclick=”changeDiv(‘dropdown2’);”>Glasgow North</option>
<option value=”south” onclick=”changeDiv(‘dropdown3’);”>Glasgow South</option>
<option value=”east” onclick=”changeDiv(‘dropdown4’);”>Glasgow East</option>
<option value=”west” onclick=”changeDiv(‘dropdown5’);”>Glasgow West</option>
<option>————————</option>

<option value=”argyll” onclick=”changeDiv(‘dropdown6’);”>Argyll and Bute</option>
<option value=”ayrshire” onclick=”changeDiv(‘dropdown7’);”>Ayrshire</option>
<option value=”dumbartonshire” onclick=”changeDiv(‘dropdown8’);”>Dumbartonshire</option>
<option value=”inverclyde” onclick=”changeDiv(‘dropdown9’);”>Inverclyde</option>
<option value=”falkirk” onclick=”changeDiv(‘dropdown10’);”>Falkirk</option>
<option value=”lannorth” onclick=”changeDiv(‘dropdown11’);”>Lanarkshire North</option>

<option value=”lansouth” onclick=”changeDiv(‘dropdown12’);”>Lanarkshire South</option>
<option value=”renfrewshire” onclick=”changeDiv(‘dropdown13’);”>Renfrewshire</option>
<option value=”stirlingshire” onclick=”changeDiv(‘dropdown14’);”>Stirlingshire</option>
</select>

Hope someone can help!

Thanks in advance ?

James.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@FangJul 10.2008 — Events do not work in [I]option[/I] with IE.
Copy linkTweet thisAlerts:
@JMRKERJul 10.2008 — This doesn't quite work right yet, but I'm throwing it out for your consideration. :mad:

The first 2 selections display fine, but the rest don't display yet.

I also don't get any errors in FF, so I must still have a fundamental error I haven't caught yet. ?

I'll post the current (incomplete) version and continue to investigate after I get home. :eek:

Interesting problem, just a stoooopid grammer at the keyboard at this time. :o

[code=php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
// From: http://www.webdeveloper.com/forum/showthread.php?t=186042

function changeDiv(id) {
var dd = '';
var tmp = id.split(':'); if (tmp[1] == '') { return; }
for (i=1; i<=14; i++) {
dd = 'dropdown'+i;
document.getElementById(dd).style.display = "none";
}
dd = 'dropdown'+tmp[0];
// alert(dd+':'+tmp[0]+':'+tmp[1]); // for testing

document.getElementById(dd).style.display = "block";
}
</script>
<style type="text/css">
.hiddenDIV {
display:none;
border: 1px solid red;
width:200px;
}
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<select name="region" id="region" class="searchwidth" onchange="changeDiv(this.value)">
<option value="0:">(Please Select)</option>

<option value="1:city">Glasgow City Centre</option>
<option value="2:north">Glasgow North</option>
<option value="3:south">Glasgow South</option>
<option value="4:east">Glasgow East</option>
<option value="5:west">Glasgow West</option>

<option value="0:">------------------------</option>

<option value="6:argyll">Argyll and Bute</option>
<option value="7:ayrshire">Ayrshire</option>
<option value="8:dumbartonshire">Dumbartonshire</option>
<option value="9:inverclyde">Inverclyde</option>
<option value="10:falkirk;">Falkirk</option>
<option value="11:lannorth;">Lanarkshire North</option>
<option value="12:lansouth">Lanarkshire South</option>
<option value="13:renfrewshire">Renfrewshire</option>
<option value="14:stirlingshire">Stirlingshire</option>
</select>

<div id="dropdown1" class="hiddenDIV"">Glasgow City Centre</div>
<div id="dropdown2" class="hiddenDIV">Glasgow North</option>
<div id="dropdown3" class="hiddenDIV">Glasgow South</option>
<div id="dropdown4" class="hiddenDIV">Glasgow East</option>
<div id="dropdown5" class="hiddenDIV">Glasgow West</option>
<div id="dropdown6" class="hiddenDIV">Argyll and Bute</option>
<div id="dropdown7" class="hiddenDIV">Ayrshire</option>
<div id="dropdown8" class="hiddenDIV">Dumbartonshire</option>
<div id="dropdown9" class="hiddenDIV">Inverclyde</option>
<div id="dropdown10" class="hiddenDIV">Falkirk</option>
<div id="dropdown11" class="hiddenDIV">Lanarkshire North</option>
<div id="dropdown12" class="hiddenDIV">Lanarkshire South</option>
<div id="dropdown13" class="hiddenDIV">Renfrewshire</option>
<div id="dropdown14" class="hiddenDIV">Stirlingshire</option>


</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@JMRKERJul 10.2008 — Spotted one error just as I posted:

Change[code=php]<div id="dropdown1" class="hiddenDIV">Glasgow City Centre</div>[/code]
but still did not fix the underlying problem ... :o
Copy linkTweet thisAlerts:
@JMRKERJul 10.2008 — OK, found stupid error. Too much cut-n-paste for my own good. :o
[code=php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DropDown Split Display</title>

<script language="javascript" type="text/javascript">
// From: http://www.webdeveloper.com/forum/showthread.php?t=186042

function changeDiv(id) {
var dd = '';
var tmp = id.split(':'); if (tmp[1] == '') { return; }
for (i=1; i<=14; i++) {
dd = 'dropdown'+i;
document.getElementById(dd).style.display = "none";
}
dd = 'dropdown'+tmp[0];

// alert(dd+':'+tmp[0]+':'+tmp[1]); // for testing

document.getElementById(dd).style.display = "block";
}
</script>

<style type="text/css">
.hiddenDIV {
display:none;
border: 1px solid red;
width:200px;
}
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<select name="region" id="region" class="searchwidth" onchange="changeDiv(this.value)">
<option value="0:">(Please Select)</option>

<option value="1:city">Glasgow City Centre</option>
<option value="2:north">Glasgow North</option>
<option value="3:south">Glasgow South</option>
<option value="4:east">Glasgow East</option>
<option value="5:west">Glasgow West</option>

<option value="0:">------------------------</option>

<option value="6:argyll">Argyll and Bute</option>
<option value="7:ayrshire">Ayrshire</option>
<option value="8:dumbartonshire">Dumbartonshire</option>
<option value="9:inverclyde">Inverclyde</option>
<option value="10:falkirk;">Falkirk</option>
<option value="11:lannorth;">Lanarkshire North</option>
<option value="12:lansouth">Lanarkshire South</option>
<option value="13:renfrewshire">Renfrewshire</option>
<option value="14:stirlingshire">Stirlingshire</option>
</select>

<div id="dropdown1" class="hiddenDIV">Glasgow City Centre</div>
<div id="dropdown2" class="hiddenDIV">Glasgow North</div>
<div id="dropdown3" class="hiddenDIV">Glasgow South</div>
<div id="dropdown4" class="hiddenDIV">Glasgow East</div>
<div id="dropdown5" class="hiddenDIV">Glasgow West</div>
<div id="dropdown6" class="hiddenDIV">Argyll and Bute</div>
<div id="dropdown7" class="hiddenDIV">Ayrshire</div>
<div id="dropdown8" class="hiddenDIV">Dumbartonshire</div>
<div id="dropdown9" class="hiddenDIV">Inverclyde</div>
<div id="dropdown10" class="hiddenDIV">Falkirk</div>
<div id="dropdown11" class="hiddenDIV">Lanarkshire North</div>
<div id="dropdown12" class="hiddenDIV">Lanarkshire South</div>
<div id="dropdown13" class="hiddenDIV">Renfrewshire</div>
<div id="dropdown14" class="hiddenDIV">Stirlingshire</div>

</body>
</html>
[/code]

Modify to your heart's content ... Good Luck! ?
Copy linkTweet thisAlerts:
@JablesauthorJul 11.2008 — Thank you so much. ? Works perfectly!

If I could I'd so send you some sweeties right now. ?
Copy linkTweet thisAlerts:
@JMRKERJul 11.2008 — You're most welcome ... Glad I was able to help. ?
×

Success!

Help @Jables 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...