By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

Script working in IE but not in Firefox

P: 4
Hello,
My java script function is working well in IE but not in Firefox

My javascript is

function visible()
{
if(document.getElementById('Jurisdiction').getAttr ibute("value")=="AL"&&document.getElementById('rdo Reservation').getAttribute("checked")==true)
{

document.getElementById("ALRes").style.visibility ='visible';
}
if(document.getElementById('Jurisdiction').getAttr ibute("value")=="AL"&&document.getElementById('rdo Registration').getAttribute("checked")==true)
{
document.getElementById('ALReg').style.display='bl ock';
}

The above function is to display a particular div this is working in IE but not in firefox

My div is
<div id="AKRes" style="display:none">
<div class="contentBoxHeader">
<h3>Alaska Registration Information</h3>
</div>
---------
---------
---------
</div>

I am calling this function in my dropdown like this
<select id="Jurisdiction" name="Jurisdiction" onchange="visible();">

Any one help me please
Jun 11 '07 #1
Share this Question
Share on Google+
4 Replies


gits
Expert Mod 5K+
P: 5,390
hi ...

try to play with the following:

[HTML]
<script>
function visible() {
var menulist_value = document.getElementById('Jurisdiction').value;
var checkbox_value = document.getElementById('rdoReservation').checked;

var al_display = menulist_value == 'AL' && checkbox_value == 'true';

document.getElementById("ALRes").style.visibility = al_display ? 'visible' : 'hidden';
}
</script>

<form>

<select id="Jurisdiction" name="Jurisdiction" onchange="visible();">
<option value="AL">AL</option>
<option value="BL">BL</option>
</select>

<input type="checkbox" id="rdoReservation"/>

</form>


<div id="ALRes" style="visibility: hidden">
<div class="contentBoxHeader">
<h3>Alaska Registration Information</h3>
</div>[/HTML]

kind regards ...
Jun 11 '07 #2

P: 4
hi ...

try to play with the following:

[HTML]
<script>
function visible() {
var menulist_value = document.getElementById('Jurisdiction').value;
var checkbox_value = document.getElementById('rdoReservation').checked;

var al_display = menulist_value == 'AL' && checkbox_value == 'true';

document.getElementById("ALRes").style.visibility = al_display ? 'visible' : 'hidden';
}
</script>

<form>

<select id="Jurisdiction" name="Jurisdiction" onchange="visible();">
<option value="AL">AL</option>
<option value="BL">BL</option>
</select>

<input type="checkbox" id="rdoReservation"/>

</form>


<div id="ALRes" style="visibility: hidden">
<div class="contentBoxHeader">
<h3>Alaska Registration Information</h3>
</div>[/HTML]

kind regards ...

Thanks for ur reply, but my problem is i have some 64 options in dropdown and 128 divs (2div for one option) i am also using radio button
so please help
Jun 11 '07 #3

gits
Expert Mod 5K+
P: 5,390
... in that case you should try not to hide/show divs ... it would be much better to create your elements depending to your selection ... and append them to a single container ... you set the attributes that you need dependent to your selection ... and this would be much better to code and to maintain ...

kind regards ...
Jun 11 '07 #4

gits
Expert Mod 5K+
P: 5,390
... i thought it over ;) ... it seems that you have the value of your select-box suffixed with 'Res' and 'Reg' for your divs? ... is that a general rule in your html-code, so that we may rely on that? ... please try to make more clear what is the problem. are there differences between the divs or do they all have the same elements? ...
Jun 11 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.