Hello ,
I have to show a drop down of newspapers/maganizes if newspaper/magazine is selected from drop down otherwise i have a show a
test box for some other values.
If nothing is selected there should be hidden. For that I am trying to use div tags and then block or show the dropdowns. But my javascript is not working can anyone tell wat is wrong in this.
I am using javascript in
struts. can anyone tell me what is wrong in this,
<html:select property="referral" title="Referral" styleId="Referral" onchange="showOptions(this)">
<html
ption value="" >Select</html
ption>
<html
ption value="Email">Email</html
ption>
<html
ption value="Direct Mail">Direct Mail</html
ption>
<html
ption value="Newspaper">Newspaper</html
ption>
<html
ption value="Magazine">Magazine</html
ption>
</html:select>
I am using div tags to hide the data.In my javascript i m setting/hiding these div tags based on values passed from drop down.
<div id="MagazineOptions">
<tr>
<th scope="row" class="extraSpace"><br /><label for="ReferralOther">Please specify which magazine*</label></th>
<td class="extraSpace"><br /><html:select property="referralOther" title="Magazine Title" styleId="Referral">
<html
ption value=" ">Select</html
ption>
<html
ption value="Town Country">Town & Country</html
ption>
<html
ption value="Veranda">Veranda</html
ption>
<html
ption value="Other">Other</html
ption>
</html:select></td>
</tr>
</div>
Here is my javascript code..
function showOptions(name){
if (name=="Newspaper") {
document.getElementById("NewspaperOptions").style.display="none";
document.getElementById("MagazineOptions").style.display="block";
document.getElementById("ReferralOther").style.display="block";
}
elseif (name=="Magazine") {
document.getElementById("NewspaperOptions").style.display="block";
document.getElementById("MagazineOptions").style.display="none";
document.getElementById("ReferralOther").style.display="block";
}
elseif ((name=="Member Referral")||(name=="Hotel Guest")) {
document.getElementById("NewspaperOptions").style.display="block";
document.getElementById("MagazineOptions").style.display="block";
document.getElementById("ReferralOther").style.display="none";
}
}
This is not working for me. can anyone tell me wat is wrong in this..
Thanks
[ January 05, 2007: Message edited by: Bear Bibeault ]