hey all,
i have a problem with radio buttons showing and hiding divs in IE. i can't figure out what the problem is. when i click on the radiobutton nothing changes. it's only when i click somewhere else, it changes. can someone tell me how i can change it instantly.
here is a my html sample: - <form name='Sel'>
-
<input type='radio' name='selector' value='val1' id='val1' checked=true onchange='Change()'/> //also tried onclick
-
<label>val1</label>
-
<input type='radio' name='selector' value='val2' id='val2' onchange='Change()'/> //also tried onclick
-
<label>val2</label>
-
</form>
-
<div id='switchable1' style='display: block'>
-
<p>val1</p>
-
</div>
-
<div id='switchable2' style='display: none'>
-
<p>val2</p>
-
</div>
and this is my javascript function: - function Change(){
-
if (document.Sel.selector[0].checked){
-
$("switchable1").style.display = "block";
-
$("switchable2").style.display = "none";
-
accessSQL=true;
-
}
-
if (document.Sel.selector[1].checked){
-
$("switchable1").style.display = "none";
-
$("switchable2").style.display = "block";
-
accessSQL=false;
-
}
-
}
nice detail, it does work in FF.
11 2536
That's because you're using onchange. Use onclick instead.
i thought so too therefor i tried it already. and it gives the same problem. it seems like IE only changes the checked value after the onclick- and onchange-event.
I tested your code in IE6/7 using onclick and it worked fine.
OnClick events works on both IE and Mozilla as well, The code what u had given is working in Mozilla...
Regards
Ramanan Kalirajan
well then i'm not sure what i'm doing wrong cause it doesn't work here. i've tried both onclick and onchange and nothing really changes. to RamananKalirajan: yep, in mozilla it works fine. the problem lies with IE (as always, people should stop using it:p)
Perhaps the problem is how your dollar $() function is defined. I just replaced that with document.getElementById().
never had any problem with prototype(cause it's a part from that framework), but i'll try as soon as possible. i dont have the code here atm so ill do it tomorrow.
In that case, it may well be some other code on the page that's affecting things. If you just test the code you've posted, it should work.
ok, i solved the problem with onclick and still using prototype
how?: by restarting my computer :-o
???
i have no idea why it didn't work before and even less why it does now but it does and thats what matters.
ty acoder, ty Ramanan
Oh, one of those! Restart the computer and everything works fine. Glad it's now working.
May be its due to the temp variables and temp files.. that may be bothering you, but i am not sure.. I am glad that you got it working..
Regards
Ramanan Kalirajan
Sign in to post your reply or Sign up for a free account.
Similar topics
by: David |
last post by:
Hi everyone,
Hoping there are some .js/browser experts out there that can help with this
weird problem.
I have made a swap div routine and applied the events to menu buttons with a
closer...
|
by: jerryyang_la1 |
last post by:
I've found this script that allows be to hide/show form elements..
<script language="JavaScript"><!--
var toggle = true;
function show(object) {
if (document.layers && document.layers)...
|
by: dje |
last post by:
In the OnClick event on a radioButtonList, I run a javascript to
show/hide the appropriate div along with a submit button, which
displays as expected. The problem is the submit no longer works on...
|
by: bridgemanusa |
last post by:
Hi All:
I have a very long page of html that I want to take portions and hide
them in divs, then show when a link is clicked. I have the hide show
part working when the link is clicked, however...
|
by: asilverpeach |
last post by:
Hey Guys!
Found some great scripts here on this topic but have to make to changes to the code that I can't seem to figure out.
First,
In the following code clicking on the headers shows the...
|
by: ali |
last post by:
Hello every one
i need you help regarding div hide and show. i am having a link like
<a href="#" onClick="expandWin()">show/hide </a>
<div id=showHide>
</div>
within div i have lots of...
|
by: dusk |
last post by:
Hi,
I have a page with lots of hidden divs which are revealed based on choices made at each 'layer'.
So I've used naming convention which represents the order in which each div becomes...
|
by: ryrocks |
last post by:
Hi,
Im making a 'contact us' page. The user click on the div, this then reveals another larger div displaying more information giving the effect of the box expanding or dropping down.
I have 3...
|
by: Mike P |
last post by:
How would I show or hide a div that is using client side Javascript
based upon a server side variable?
Here are my divs :
<div id="idButton5" class="otherLeftBarLink" onmouseover="javascript:...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |