command in another window

A

artz

hi there.. i will try to describe the problem...

Here is thing. I have a document loaded in a browser that has some
javascript functions and it has also a iframe that opens another doc.
In this doc I have a button or link that runs a command for a function
that is located in the first doc.

I've got it work just fine in FireFox but in the crappy Internet
Explorer it didnt work.

Any solutions? Thanks!

To ilustrate:
doc1.html
Code:
<head>
<SCRIPT LANGUAGE="JavaScript"><!--
function myfunc() {
alert('Yes!');
}
//--></SCRIPT>
</head>
<body>
<iframe src=doc2.html></iframe>
</body>

doc2.html
Code:
<head>
<SCRIPT LANGUAGE="JavaScript"><!--
var ie5=(w3c && document.all)? true : false;

function comMain (inner) {
var msgWindow=open('','_top','');
var html_doc =
msgWindow.document.getElementsByTagName('head').item(0);
var js = document.createElement('script');
js.setAttribute('language', 'javascript');
js.setAttribute('type', 'text/javascript');

if (!ie5)
js.innerHTML = inner;
else js.text = inner;

html_doc.appendChild(js); //The error!!!!
}
//--></SCRIPT>
</head>
<body>
<a href=# onclick='comMain("myFunc()")'>click me</a>
</body>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top