471,109 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,109 software developers and data experts.

Loading Javascript dynamically into a page.

I have a 3 frame window. When you type an address in the top it loads it in the middle. This works well but I need to dynamically load a small javascript function into the page that loads. I didn't know if it was possible to just throw it in there some how or if I have to copy the entire contents of the web site into an array which already holds the script....and if this was the case I am not even sure how to do it. If anyone can help that would be great.

Thanks in advance.

-- EDIT --

Ok, I decided to use IFrames instead of normal frames. So now I have 3 iFrames called Top, Middle, Bottom. I have a textbox in top that I want users to type an address in and it opens that page in middle....but I can't figure it out. I have tried many variations of...


What am I doing wrong?

Thank you again
Jul 11 '07 #1
4 1415
Bwa ha ha! I got it! Well, at least the opening of the web page into the iframe..


I am still needing to dynamically insert a script into this new page that loads though. I cant have it call the parent function because that page doesn't know about it because it is an outside page, such as google.com, msnbc.com, etc. I want to insert the javascript function at the top of the page that loads there...if its possible



--- EDIT ---

Would something like this work?

var e = '"onMouseDown=parent.getSelText()" oncontextmenu="return false;"';


var myElement = document.createElement('<BODY onMouseDown="getSelText()" oncontextmenu="return false;">');
Jul 11 '07 #2
16,027 Expert Mod 8TB
If the page is from another domain, you won't be able to modify it (as far as I recall). Is it from the same domain?
Jul 12 '07 #3
Its not from the same domain....Grrrr...

Any ideas on what I can use to get this to work? .cgi, php, asp? I need to take a web page and insert 1 line of code into it. When they use the url box to change pages it then inserts the line of code into that page as well.
Jul 12 '07 #4
16,027 Expert Mod 8TB
What does that one line of code do?
Jul 14 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Randy Webb | last post: by
4 posts views Thread by John | last post: by
1 post views Thread by ozzy.osborn | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.