SitePoint Sponsor |
|
User Tag List
Results 1 to 14 of 14
Thread: Why isn't this working?
-
Jul 1, 2008, 04:56 #1
Why isn't this working?
PHP Code:<script>
function lol() {
myFrame.document.open();
myFrame.document.write("LOLOLOLOLOLOLOLOLOLOLOLOLOLOL<br>LOLOLOLOLOL");
myFrame.document.close();
}
</script>
<iframe name="myFrame" id="myFrame" height="700" src ="http://www.google.pt" width="100%"></iframe>
<script>lol();</script>
-
Jul 1, 2008, 05:13 #2
- Join Date
- Jun 2004
- Location
- Mumbai, India
- Posts
- 541
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
you can try something like this
Code:<iframe name="myFrame" id="myFrame" height="700" src ="" width="100%"></iframe> <script> vikrantObj = document.getElementById("myFrame"); vikrantObj.src = "http://www.google.pt/search?site=&hl=pt-PT&q=LOLOLOLOLLO"; </script>
Vikrant Korde
S Y S T I M E, Mhape,
Mumbai, Maharashtra, India.
-
Jul 1, 2008, 05:16 #3
-
Jul 1, 2008, 09:25 #4
-
Jul 1, 2008, 12:42 #5
-
Jul 1, 2008, 12:55 #6
- Join Date
- Mar 2004
- Location
- West Midlands, United Kingdom
- Posts
- 2,631
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:<script> function lol() { var myFrame = document.getElementById('myFrame'); myFrame.document.write("LOLOLOLOLOLOLOLOLOLOLOLOLOLOL<br>LOLOLOLOLOL"); myFrame.document.close(); } </script> <iframe name="myFrame" id="myFrame" height="700" src ="http://www.google.pt" width="100%"></iframe> <script>lol();</script>
-
Jul 1, 2008, 13:18 #7
No it didnt work, i tested it this way:
PHP Code:<script>
function lol() {
var myFrame = document.getElementById('myFrame');
alert("Hi!!");
myFrame.document.write("LOLOLOLOLOLOLOLOLOLOLOLOLOLOL<br>LOLOLOLOLOL");
alert("done!");
myFrame.document.close();
}
</script>
<iframe name="myFrame" id="myFrame" height="700" src ="http://www.google.pt" width="100%"></iframe>
<script>lol();</script>
When i run it, he says "Hi!!", but then it DOESNT say "done!", meaning that the script crashes somewhere between those 2 alerts, meaning that the problem is the line:
myFrame.document.write("LOLOLOLOLOLOLOLOLOLOLOLOLOLOL<br>LOLOLOLOLOL");
-
Jul 1, 2008, 13:26 #8
- Join Date
- Mar 2004
- Location
- West Midlands, United Kingdom
- Posts
- 2,631
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Jul 1, 2008, 13:32 #9
-
Jul 1, 2008, 13:35 #10
i tried this line now on IE7:
myFrame.document.body.InnerHTML="LOLOLOLOLOLOLOLOLOLOLOLOLOLOL<br>LOLOLOLOLOL";
but it doesnt do nothing as wel...
-
Jul 1, 2008, 13:43 #11
- Join Date
- Mar 2004
- Location
- West Midlands, United Kingdom
- Posts
- 2,631
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think you might be fighting a loosing battle with this, what is it you are actually trying to do, since there may be a better solution.
-
Jul 1, 2008, 13:43 #12
I think Iframe.DOCUMENT isn't the right property, the .document doesnt reffer to the iframe's inner page.
edit: I want to change the HTML of the page that the Iframe opens.
-
Jul 1, 2008, 15:05 #13
- Join Date
- Sep 2006
- Posts
- 731
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Jul 2, 2008, 02:28 #14
Bookmarks