Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > innerhtml.... produces Microsoft Internet Explorer error

Reply
Thread Tools

innerhtml.... produces Microsoft Internet Explorer error

 
 
Jason
Guest
Posts: n/a
 
      04-17-2004
I have a web page that contains textareas. These are dynamically
added via asp when the page loads based on database records. The user
also has the ability to add more text areas via innerhtml. If the
user clicks the add text area button too fast or too many times.. they
will get the following error:

Internet Explorer Has Encountered a Problem and Needs to Close.

After reading msdns page about this error I doubt that there is a fix
to this. However, any suggestions on how I could work around this
error with a different approach than innerhtml? Any help would be
greatly appreciated. Please see the example below.

<html>
<script language="javascript">
function addvalue(){

myid.innerHTML += '<div id="mydiv2"><table border=0 cellpadding=0
cellspacing=0><tr><td width=80 align="center">&nbsp;<td><td><textarea
name="mytext"></textarea></td></tr></table></div>';
}


</script>



<body>
clicking too fast can cause ie
error<table><tr><td><table><tr><td><table><tr><td>
<input type="button" OnClick="addvalue();" value="add text area">
<div id="myid"><%
'asp code that dynamically adds textareas

%>
</td></tr></td></tr></td></tr></table>
</div>
</body>
</html>
 
Reply With Quote
 
 
 
 
Mick White
Guest
Posts: n/a
 
      04-17-2004
Jason wrote:
> I have a web page that contains textareas. These are dynamically
> added via asp when the page loads based on database records. The user
> also has the ability to add more text areas via innerhtml. If the
> user clicks the add text area button too fast or too many times.. they
> will get the following error:
>
> Internet Explorer Has Encountered a Problem and Needs to Close.
>
> After reading msdns page about this error I doubt that there is a fix
> to this. However, any suggestions on how I could work around this
> error with a different approach than innerhtml? Any help would be
> greatly appreciated. Please see the example below.
>
> <html>
> <script language="javascript">
> function addvalue(){
>
> myid.innerHTML += '<div id="mydiv2"><table border=0 cellpadding=0
> cellspacing=0><tr><td width=80 align="center">&nbsp;<td><td><textarea
> name="mytext"></textarea></td></tr></table></div>';
> }
>
>
> </script>


2 problems:
myid.innerHTML s/b:
document.getElementById("myid").innerHTML

You need form tags.
Mick
>
> <body>
> clicking too fast can cause ie
> error<table><tr><td><table><tr><td><table><tr><td>
> <input type="button" OnClick="addvalue();" value="add text area">
> <div id="myid"><%
> 'asp code that dynamically adds textareas
>
> %>
> </td></tr></td></tr></td></tr></table>
> </div>
> </body>
> </html>

 
Reply With Quote
 
 
 
 
Bill
Guest
Posts: n/a
 
      04-19-2004
Thank you for the reply!! However, both of the issues you mentioned are
taken care of on my live page. I was using that html/javascript as an
example. What I am looking for is an alternative to using innerhtml as
to avoid the internet explorer error. Talk to you soon.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
kaeli
Guest
Posts: n/a
 
      04-19-2004
In article <40841568$0$203$>,
enlightened us with...
> Thank you for the reply!! However, both of the issues you mentioned are
> taken care of on my live page. I was using that html/javascript as an
> example. What I am looking for is an alternative to using innerhtml as
> to avoid the internet explorer error. Talk to you soon.
>


Use real DOM methods as applicable. See createElement, appendChild,
createTextNode, etc.

http://msdn.microsoft.com/library/default.asp?
url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp

function addvalue(someNode)
{
myNewElement = document.createElement("div");
myNewElement.setAttribute("id","mydiv2");
someNode.appendChild(myNewElement);
}

e = document.getElementById("someDiv");
addValue(e);

--
--
~kaeli~
The Bermuda Triangle got tired of warm weather. It moved to
Finland. Now Santa Claus is missing.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer 8: C:\Program Files\Internet Explorer\iexplore.exe vs C:\Program Files (x86)\Internet Explorer\iexplore.exe Nathan Sokalski Windows 64bit 16 02-22-2010 08:31 AM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
OutputStream from a URLConnection produces an OutOfMemory OutputStream from a URLConnection produces an OutOfMemory WinstonSmith_101@hotmail.com Java 2 10-25-2006 04:45 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57