Hai, I'm new to Javascript and after a lot of searching I still have no answer. I wrote a little script (combination of html/php and javascript), but I have a problem with the Javascript part, or better said, a problem when I use IE6 as browser cliënt. (Yes, I want it to run on IE6 as well
In short, I have a list with radiobuttons (generated bij PHP), when I check one, I use the OnChange event to show the value in a seperate DIV. Works with Firefox, but with IE6 (and others maybe) it returns an old value of the 'previous' selection...
I'm at a loss, I really can't find the solution. Can somebody help me?
Here is the exact (php/JS) code I use:
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Radiobutton Keuze Test</title> <style type="text/css"> <!--
.button_list { text-align: center; min-width:125px; width:125px; height: 100px; float: left; } --> </style>
<SCRIPT LANGUAGE="JavaScript"> <!-- function Val_Radio () {
for (var i=0; i < document.kiesbutton.button.length; i++) { if (document.kiesbutton.button[i].checked) { var keuze = document.kiesbutton.button[i].value; } }
document.getElementById('snippet').innerHTML = 'Waarde is : ' + keuze; } --> </SCRIPT>
<div style="width:520px; height:400px; overflow:scroll;"> <form name="kiesbutton"> <?php for ($i=1; $i < 21; $i++) echo " <div class='button_list'> <input onChange=\"Val_Radio()\" type='radio' name='button' value='$i'".($i == 1 ? " checked" : "")."><br> {$i} </div>"; ?> </form> </div>
<span id="snippet">Waarde is : 1</span>
</body> </html>
Thank you 
Last edited by rvdv12773; 12-13-2010 at 12:28 PM..
|