Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 15th, 2006, 01:22 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with IE's innerHTML and <form> tags??!?!

I'm having a really hard time with IE's innerHTML property and <form>
tags. If I use this code:

myDiv.innerHTML = "<form>This is a test</form>" in fireFox, the div tag
shows the content. However, if I do the same in IE, nothing happens.
For whatever reason, IE will not take that content.


Has anybody run into this, and what's a good solution? (Please, no "use
FireFox!" answers - we have users that use both equally).


Thanks for any help.

 
Old February 15th, 2006, 05:08 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Nebulus!!
In IE ,I am getting the Runtime error,I have a solution
<html>
<head>
<script type="text/JavaScript">
function CreateForm(){

myDiv=document.getElementById("mydiv")

frm=document.createElement("form")
frm.appendChild(document.createTextNode('This is a test'))

myDiv.appendChild(frm) //--Working Fine

/********Runtime Error--with Error Number-2146827687******
try
{
 myDiv.innerHTML ="<form>frm</form>"
}
catch(error)
{
alert(error.descripton)
alert(error.number)
}
*/
}


</script>
</head>
<body>
<form>
<div id="mydiv"></div>
<input type=button value="createform" onclick="CreateForm()">
</form>
</body>
</html>
Hope this will help you

Cheers :)

vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
<!DOCTYPE> Tags? kennethjaysone HTML Code Clinic 0 May 18th, 2007 01:39 AM
Regular Expression to remove <table> </table> tags mathalete CSS Cascading Style Sheets 2 January 23rd, 2006 01:59 PM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
using variables within <td> tags handyman Javascript How-To 3 June 15th, 2004 11:18 PM
Using <pre> tags in a DataList mpaergk VS.NET 2002/2003 2 November 18th, 2003 01:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.