codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  IE no like innerHTML? FF does...  GoldDog at 22:23 on Monday, May 16, 2005
 

Can anyone tell me why IE doesn't like this script?

My function looks like this...

var c = 0;
function reCalc(i) {
c = 10*i;
document.getElementById('subT').innerHTML = c;
}

...and the call to the function looks like this...

<select name="qty" onchange="reCalc(this.value)">

...and the page element 'subT' looks like this...

$<span id="subT">275</span>

In Mozilla subT gets rewritten to reflect the math requested in the function, but IE insists on setting the value of subT to 0 every time.

Any ideas? Thanks

  Re: IE no like innerHTML? FF does...  tgreer at 15:04 on Thursday, June 02, 2005
 

I'm guessing it's a problem with the "this" reference in the select. You should be passing in the value of the option. Research the select/option object heirarchy.


  Re: IE no like innerHTML? FF does...  Troy Wolf at 21:29 on Sunday, June 05, 2005
 

I'm gonna bet you a #3 from McDonalds that your SELECT element looks something like this:
<option>1</option>
<option>2</option>
<option>3</option>

That will work as you expect in FF, but not in IE. The proper way to build SELECT options is this:
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>

THAT will work in IE and FF! Enjoy!
Troy Wolf: site expert
SnippetEdit Website Editor









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
• Re: store string from text file to vector
• Re: c# .net Exception of type System.StackOverflowException was thrown.
• Re: error: expression must have a constant value
• Re: Script Does Folder Exist – If Not Create It
• $_GET not working
• GET METHOD
• Re: windows service - web service - com
• Re: Storing data from HTML to Excel or TXT
• Re: Help totalReads=1 totalReads++=2 write totalReads 3 not 2


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010