I've written a function to dynamically create a form with a textarea and to
create a iframe. I want to submit the form to the iframe.
It works in NS7 but it doesn't work in IE6. In IE6 it opens a new window.
Could anyone explain to me why this is?
Thanks in advance.
Greetz Jolly.
Below is the code:
Code: Select all
<html>
<head>
<SCRIPT language="javascript">
var myframe;
var myform;
function start(){
myframe = document.createElement('iframe');
myframe.setAttribute('id','testid');
myframe.setAttribute('name','testname');
myform = document.createElement('form');
myform.action = 'test5.php';
myform.method = 'post';
myform.target='testname';
myform.name='myform';
mytextarea = document.createElement('textarea');
mytextarea.name='mboxml';
mytextarea.value='this is a test value';
mytextarea.cols='80';
mytextarea.rows='10';
myform.appendChild(mytextarea);
document.body.appendChild(myform);
document.body.appendChild(mydiv);
document.body.appendChild(myframe);
alert(document.body.innerHTML);
}
</SCRIPT>
</head>
<body onload="start();">
<input type="button" onclick="myform.submit();">
</body>
</html>