472,794 Members | 2,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 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.
Rob



-- 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...

window.frames['middle'].location.href=window.frames['title'].document.forms[field1].value;

What am I doing wrong?

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

frames['middle'].location.href=frames['title'].document.getElementById('field1').value;

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

HELP!

=)


--- EDIT ---

Would something like this work?

frames['middle'].location.href=frames['title'].document.getElementById('field1').value;
var e = '"onMouseDown=parent.getSelText()" oncontextmenu="return false;"';
frames['title'].document.getElementsByTagName("body")[0].appendChild(e);

or

var myElement = document.createElement('<BODY onMouseDown="getSelText()" oncontextmenu="return false;">');
frames['middle'].document.all.myBody.appendChild(myElement);
Jul 11 '07 #2
acoder
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
acoder
16,027 Expert Mod 8TB
What does that one line of code do?
Jul 14 '07 #5

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

Similar topics

10
by: Randy Webb | last post by:
This page: http://www.hikksworld.com/loadJSFiles/ Is one where I was testing the ability of browsers that can/can't dynamically load a JS file with one of the three methods: 1)Changing the src...
4
by: John | last post by:
Hi all, I'm having a little problem understanding the concepts of dynamically loading/unloading user conrols: 1. If I have a couple of usercontrols embedded within a few tables cells on my...
17
by: CES | last post by:
All, I was wondering if their is a way of loading an external script fill from within a script?? <script language="javascript" type="text/javascript"> function test(var){ <script...
5
by: Tudor Tihan | last post by:
Hi, This is my first post here, so please be kind. I have tryed to make a javascript html page loader by using an invisible <IFrame> and some javascript variable text passing between...
1
by: ozzy.osborn | last post by:
Hello All, I have been struggling with a cross browser solution to loading external javascript files on the fly. I have been successful using the following code in IE6: var newScr =...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.