/    Sign up×
Community /Pin to ProfileBookmark

onclick/onmousedown with IE forms

I have a form created and with one of the dropdown option selections, i’m trying to have the ability to hide another separate form on that page. And with the other 2 available options, it should turn that field back on. Works fine in firefox, not in IE. I’ve tried both onclick and onmousedown and neither work. What am i doing wrong, i gotta get this thing working ?

my code is below

[CODE]

<script type=”text/javascript”>
function On() {
document.getElementById(“hidediv”).style.display = “block”;
}
function Off() {
document.getElementById(“hidediv”).style.display = “none”;
}
</script>

<div class=”form”>
<form action=””>
<select name=”shaft-type” class=”custom” id=”shaftopt” >
<option value=”default” selected=”selected” onClick=”On();”>Shaft Type – Default</option>
<option value=”hollow” onClick=”On();”>Hollow Shaft</option>
<option value=”needle” onClick=”Off();”>Needle</option>
</select>
</form>
</div>

<div id=”hidediv”>
<div class=”form”>
<form action=””>
<select name=”shaft-length” class=”custom” id=”lengthopt”>
<option value=”default” selected=”selected”>Shaft Length – 4cm. (min)</option>
<option value=”media2″>Media 2</option>
</select>
</form>
</div>
</div>
[/CODE]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@pollymacApr 29.2009 — [CODE]

<script type="text/javascript">
function formDisplay(shaftOpVal) {
if(shaftOpVal=='default' || shaftOpVal=='hollow') document.getElementById("hidediv").style.display = "block";
else document.getElementById("hidediv").style.display = "none";
}

</script>

<div class="form">
<form action="">
<select name="shaft-type" class="custom" id="shaftopt" onChange="formDisplay(this.value);">
<option value="default" selected="selected">Shaft Type - Default</option>
<option value="hollow">Hollow Shaft</option>
<option value="needle">Needle</option>
</select>
</form>
</div>


<div id="hidediv">
<div class="form">
<form action="">
<select name="shaft-length" class="custom" id="lengthopt">
<option value="default" selected="selected">Shaft Length - 4cm. (min)</option>
<option value="media2">Media 2</option>
</select>
</form>
</div>
</div>
[/CODE]
Copy linkTweet thisAlerts:
@erkerr67authorApr 29.2009 — fantastic, thank you kindly! I tried a little bit to use the change method but I'm not very familiar with that....wish I knew more javascript. Slowly but surely though. Thanks again for your help, I really appreciate it.
Copy linkTweet thisAlerts:
@erkerr67authorApr 29.2009 — disregard
Copy linkTweet thisAlerts:
@erkerr67authorApr 29.2009 — disregard
×

Success!

Help @erkerr67 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.6,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

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