Debt Consolidation - Debt Consolidation - Find jobs - Discount Perfume - Free Games

PDA

View Full Version : Very Urgent: Please help me to solve this problem.


tamilsoft
Jun 12th 2007, 11:13 am
Hi,

I got the follwing error,while creating a dynamic iframe with remote url using javascript.

"Internet Explorer cannot open the Internet Site www.mydomain.com
Operation Aborted";

Here is My Code:

var iframe = document.createElement("iframe");
iframe.setAttribute("src", "http://www.someotherdomain.com/test.html");
iframe.setAttribute("scrolling", "no");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("height","400");
iframe.setAttribute("width","300");
document.body.appendChild(iframe);



Please help me to overcome this.

ajsa52
Jun 12th 2007, 11:40 am
You need to execute your code after the load of your page: Fill that code on a function called after load, so:

(Tested only on FireFox).


<html>

<head>
<script type="text/javascript">
function f_create()
{
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "http://www.someotherdomain.com/test.html");
iframe.setAttribute("scrolling", "no");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("height","400");
iframe.setAttribute("width","300");
document.body.appendChild(iframe);
}
</script>
</head>

<body onLoad="f_create();">
hello
</body>

</html>

tamilsoft
Jun 12th 2007, 9:12 pm
You need to execute your code after the load of your page: Fill that code on a function called after load, so:

(Tested only on FireFox).


<html>

<head>
<script type="text/javascript">
function f_create()
{
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "http://www.someotherdomain.com/test.html");
iframe.setAttribute("scrolling", "no");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("height","400");
iframe.setAttribute("width","300");
document.body.appendChild(iframe);
}
</script>
</head>

<body onLoad="f_create();">
hello
</body>

</html>


Yeah, It's working now, Thankzz