The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> JavaScript Development
|
InnerHTML & IE
Discuss InnerHTML & IE in the JavaScript Development forum on Dev Shed. InnerHTML & IE JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

July 6th, 2007, 02:10 PM
|
 |
Only the strong survives!!.
|
|
Join Date: Feb 2003
Location: A World of wonders.
|
|
|
InnerHTML & IE
hehe.. I guess I'm still going at it heh  anyways.. does anyone know if innerHTML works well on IE? Cause I run this snippet
javascript Code:
Original
- javascript Code |
|
|
|
AjaxRequest.onreadystatechange = function (){ if (AjaxRequest.readyState == 4) { if (AjaxRequest.status == 200){ var insertHTML = document.getElementById ("msg"); insertHTML.innerHTML = AjaxRequest.responseText; } } }
on Firefox.. and it works. but on IE I get a runtime error.
html Code:
Original
- html Code |
|
|
|
<div align="center" id="msg">
<table border="0" cellpadding="0" cellspacing="0" align="center" style="width: 620px;">
<tr>
<td class="header" valign="top" align="center">
<table border="0" cellpadding="0" cellspacing="0" style="width: 90%; height: 50px;">
<tr>
<td valign="top" colspan="10">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="bottom" style="width: 100px; height: 50px;"><img src="images/fmlogo.png"></td>
<td valign="bottom" style="font-family: Eurostile; font-size: 14px; color:#990000; padding-top: 30px;">
<?php
if ($error === true)
{
print $msgErrors;
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" class="header_body" align="center" >
<table border="0" cellspadding="0" cellspacing="0" class="tdform">
<tr>
<td colspan="10" valign="top" style="padding-left: 30px;" align="center">
<br>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="font-family: Georgia, 'Times New Roman', Times, serif; color:#FFFFFF; width: 120px;">
<b>Username:</b>
</td>
<td>
<input type="text" name="username" class="textbox" id="username"><?php print $errUser; ?>
</td>
</tr>
<tr><td style="height: 10px;"></td></tr>
<tr>
<td style="font-family: Georgia, 'Times New Roman', Times, serif; color:#FFFFFF; width: 120px;">
<b>Password:</b>
</td>
<td >
<input type="password" name="password" class="textbox" id="password"><?php print $errPass; ?>
</td>
</tr>
<tr><td style="height: 10px;"></td></tr>
<tr>
<td style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 12px;" colspan="10" align="center">
<a href="#" title="Forgot Password" style="color: #FFFF33;">[Forgot Password]</a>
<input type="button" name="login" value="Login" onClick="return XMLHttpLogin();">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="footer" align="center" style="width: 621px; height: 80px; font:Verdana, Arial, Helvetica; font-size: 13px;" valign="top">
To request an account please contact the IT department<br>
All Rights Reserved
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
|

July 6th, 2007, 04:14 PM
|
 |
CSS & JS/DOM Adept
|
|
Join Date: Jul 2004
Location: USA
|
|
The innerHTML property was first created for IE4.
Support for it is a bit buggy though.
Try this:
Code:
var insertHTML = document.getElementById ("msg");
insertHTML.innerHTML = '';
insertHTML.innerHTML = AjaxRequest.responseText;
|

July 6th, 2007, 04:32 PM
|
 |
Contributing User
|
|
Join Date: May 2006
Location: Chandigarh, India
|
|
Kravvitz,
Once in a while i start getting errors when i do this.
Code:
var insertHTML = document.getElementById ("msg");
i.e. var declaration and assignment with getElementById().
I use mozilla firefox 2.0.0.4 during working.
and when i do the following:
javascript Code:
Original
- javascript Code |
|
|
|
var insertHTML; insertHTML = document.getElementById ("msg");
The error gets resolved.
Is this error from my end or some cross browsers compatibility.?
|

July 6th, 2007, 04:37 PM
|
 |
CSS & JS/DOM Adept
|
|
Join Date: Jul 2004
Location: USA
|
|
|
That's very strange. Declaring and defining a variable like that shouldn't need to be done in two separate statements.
|

July 6th, 2007, 04:46 PM
|
 |
Contributing User
|
|
Join Date: May 2006
Location: Chandigarh, India
|
|
Yes, i'll post the error next time i get. It took me a whole day to debug but at eod the issue was resolved by doing what i said above.
Quote: | Originally Posted by Kravvitz That's very strange. Declaring and defining a variable like that shouldn't need to be done in two separate statements. |
|

July 6th, 2007, 06:07 PM
|
 |
Only the strong survives!!.
|
|
Join Date: Feb 2003
Location: A World of wonders.
|
|
sumityadav going to report you for a post robbery  j/j
anyways.. I will try this out later.. going home now.
|

July 6th, 2007, 08:28 PM
|
 |
Only the strong survives!!.
|
|
Join Date: Feb 2003
Location: A World of wonders.
|
|
I did what you suggested.. but.. sadly it didn't work
javascript Code:
Original
- javascript Code |
|
|
|
var insertHTML = document.getElementById ("msg"); insertHTML.innerHTML = ''; insertHTML.innerHTML = AjaxRequest.responseText;
|

July 7th, 2007, 03:55 AM
|
|
|
Quote: | but on IE I get a runtime error. |
Show us the error.
|

July 8th, 2007, 10:15 PM
|
 |
Only the strong survives!!.
|
|
Join Date: Feb 2003
Location: A World of wonders.
|
|
Quote: | Originally Posted by Michael88 Show us the error. | heh? Well the error is straight forward.. it just says run time error.. that is all.. and the line to that error is the one I posted above. Maybe you should run the code locally. Any other alternative?
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|