Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Wrong value with document.something.value in IE6 ??
Old 12-13-2010, 12:19 PM Wrong value with document.something.value in IE6 ??
Junior Talker

Posts: 2
Name: Richard
Trades: 0
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 == " 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..
rvdv12773 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-13-2010, 02:01 PM Re: Wrong value with document.something.value in IE6 ??
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
It is sort of working but onChange only fires when focus leaves the element - so in your code you need to select a radio button then tab or click elsewhere on the page. Change it to onClick
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Old 12-13-2010, 03:03 PM Re: Wrong value with document.something.value in IE6 ??
Junior Talker

Posts: 2
Name: Richard
Trades: 0
Jee, so simple a solution! Thanx a bunch!!
rvdv12773 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Wrong value with document.something.value in IE6 ??
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11959 seconds with 12 queries