|
-
Nov 25th, 2002, 07:09 AM
#1
Thread Starter
Retired VBF Adm1nistrator
Using javascript to write a script tag ?
I'm trying to write a <script> tag with a script inside it, from another script.
But I can't seem to get it to work.
This is what I have at the moment
Code:
function redirectFrame() {
parent.main.write('<script language="JavaScript">');
parent.main.write('document.write('alert("testing")');
parent.main.write('</script>');
}
Basically, the reason for all this is that our other branch has a website, and im going to ask them to link to a particular page.
Now that page itself is a frameset, and once the page has loaded a piece of JS makes the bottom page navigate to another page.
The problem with that approach was that the piece of javascript, which I have in the frameset page itself, was executing each time the user has browesed to a new page, and then it would make them go back to a different page.
So I was thinking I would have to put a piece of JS into the created page myself.
... so um yeah.
I think I've probably confused anyone reading ?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Nov 25th, 2002, 01:05 PM
#2
Frenzied Member
Yep you've confused me But this line is wrong:
Code:
parent.main.write('document.write('alert("testing")');
it should be something like this:
Code:
parent.main.document.write('document.write(\\'alert("testing")\\')');
-
Nov 25th, 2002, 01:39 PM
#3
The other thing you can do is detect if the user is in the frameset or not. Try http://www.dynamicdrive.com I think you might find it there.
Then once you detect if you are in the frameset or not, you can change the bottom frame (or not).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|