J
John
Hi Everyone,
I'm having this extremely annoying problem with Internet Explorer 6,
giving me an error message saying "unknown runtime error" whenever I
try to alter the contents of a <div> element using innerHTML.
Now, I've researched this problem on the web, and found many references
to it, but none of them quite addressed my specific situation, and
since my experience with JavaScript is limited, I was not able to adapt
the solutions I found to my specific situation.
Anyway, it's all very basic:
I have a <div id="myDiv"></div> element that's inside a <form></form>
element. I'm trying to change the innerHTML of the <div> element when
clicking on a "radio" button.
This code works fine in Firefox:
<html>
<head>
<title>My Page</title>
<script type="text/javascript">
function ChangeContent(str)
{
var obj=document.getElementById("myDiv");
if (str=="display1")
{
obj.innerHTML = "<b>display 1 was selected</b>";
}
else if (str=="display2")
{
obj.innerHTML = "<b>display 2 was selected</b>";
}
}
</script>
</head>
<body>
<form>
Display1 <input type="radio" name="States" value="display1"
onchange="ChangeContent(this.value)" />
<br />
Display2 <input type="radio" name="States" value="display2"
onchange="ChangeContent(this.value)" />
<div id="myDiv"></div>
</form>
</body>
</html>
As I said, it works perfectly in Firefox, but in IE6 I get the error:
"unknown runtime error"
however since as I've mentioned my experience with JavaScript is
limited, I need a practical example of how I can solve this issue for
my particular situation...
Any help will be greatly appreciated!!!!!
I'm having this extremely annoying problem with Internet Explorer 6,
giving me an error message saying "unknown runtime error" whenever I
try to alter the contents of a <div> element using innerHTML.
Now, I've researched this problem on the web, and found many references
to it, but none of them quite addressed my specific situation, and
since my experience with JavaScript is limited, I was not able to adapt
the solutions I found to my specific situation.
Anyway, it's all very basic:
I have a <div id="myDiv"></div> element that's inside a <form></form>
element. I'm trying to change the innerHTML of the <div> element when
clicking on a "radio" button.
This code works fine in Firefox:
<html>
<head>
<title>My Page</title>
<script type="text/javascript">
function ChangeContent(str)
{
var obj=document.getElementById("myDiv");
if (str=="display1")
{
obj.innerHTML = "<b>display 1 was selected</b>";
}
else if (str=="display2")
{
obj.innerHTML = "<b>display 2 was selected</b>";
}
}
</script>
</head>
<body>
<form>
Display1 <input type="radio" name="States" value="display1"
onchange="ChangeContent(this.value)" />
<br />
Display2 <input type="radio" name="States" value="display2"
onchange="ChangeContent(this.value)" />
<div id="myDiv"></div>
</form>
</body>
</html>
As I said, it works perfectly in Firefox, but in IE6 I get the error:
"unknown runtime error"
"parent" "child" problem, since the <div> element is inside of a form..From what I could gather on the web, this is probably some kind of a
however since as I've mentioned my experience with JavaScript is
limited, I need a practical example of how I can solve this issue for
my particular situation...
Any help will be greatly appreciated!!!!!