View Single Post
  #4  
Old 29th October 2008, 16:20
johnake's Avatar
johnake johnake is offline
Senior Member
 
Join Date: Dec 2007
Posts: 52
Default
Phi, that is a bug specific to Internet Explorer, when you set the innerHTML property of the Select object, the changes do not take effect correctly.
If you must use innerHTML, a workaround is to use a Div object to wrap the SELECT element and then set the innerHTML property for the Div object.
Don't know XAM's code, not really interested either but I can give you an example:
HTML Code:
<html>
<head>
<title>My Example</title>
<script language="Javascript">
var origDivHTML;

function init()
{
   origDivHTML = myDiv.innerHTML;
}

function setValues() 
{
   var oldinnerHTML = "your original innerHTML: " + yourDiv.innerHTML ;     
   alert(oldinnerHTML);
   yourDiv.innerHTML = origDivHTML;
     
   var curinnerHTML = "your current innerHTML: " + yourDiv.innerHTML ; 
   alert(curinnerHTML); 
}
</script>
</head>

<body onload="init()">

<div id="myDiv">
  <select name="firstSelect" size="1" >
    <option>11111</option>
    <option>22222</option>
    <option>33333</option>
  </select>
</div>

<div id="yourDiv">
  <select name="secondSelect" size="1" >
    <option>aaaa</option>
    <option>bbbb</option>
    <option>cccc</option>
  </select>
</div>
<button onclick = "setValues();">click me to set the values</button>
</body>
</html>
Or you could follow this guide: http://domscripting.com/blog/display/99
The use of innerHTML isn't recommended by W3C either.
Cheers!
__________________
PHP Code:
class mySelf extends World
   
{
       public 
$health;
       private 
$friends;
       protected 
$love;
  
   public function 
__construct()
  {
       
$this->health 100;
       
$this->friends 2;
       
$this->love true;
  }
  protected function 
__love()
  { 
      
//has a bug... for the moment...
      //will fix it later.. until then:
      
sleep(15*365*24*3600);
  }


Last edited by johnake; 29th October 2008 at 16:32.
Reply With Quote
The Following User Says Thank You to johnake For This Useful Post:
Phi (29th October 2008)