473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Invoking a script when a link is clicked in a frame page

I have a webpage which contains two frames, let us call this as main
page and the frames as frame1 and frame2. Now if i click any link in
frame1 or frame2 a script in main page should be invoked.

Assume im not able to change the source code of frame1 and frame2. I
can only change the source code of main page. Is there any way.

Also the links may point anywhere, not necessarily "javascript:fn()".

i.e., can i control the links in frame1 and frame2 using a script
written in main page

Jul 23 '05 #1
2 1314
sravi wrote:
I have a webpage which contains two frames, let us call this as main
page and the frames as frame1 and frame2. Now if i click any link in
frame1 or frame2 a script in main page should be invoked.
Easy enough.
Assume im not able to change the source code of frame1 and frame2. I
can only change the source code of main page. Is there any way.
Yes, but assume I am too lazy to do homework today, because thats what
it sounds like.
Also the links may point anywhere, not necessarily "javascript:fn()".
Thats the worst place it could point to.
http://jibbering.com/faq/#FAQ4_24
i.e., can i control the links in frame1 and frame2 using a script
written in main page


Within some limitations, namely the cross-domain security issue.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
sravi wrote:
I have a webpage which contains two frames, let us call this as main
page and the frames as frame1 and frame2. Now if i click any link in
frame1 or frame2 a script in main page should be invoked.

Assume im not able to change the source code of frame1 and frame2. I
can only change the source code of main page. Is there any way.
Yes. You should define an method to be called if all frames are loaded,
i.e. when the frameset's "load" event occurs in the "main page". In it,
you add an event listener for the "click" event to both frame( document)s.
In that, you check if a link was clicked; if so, you perform the actions
you want, probably using the methods argument reference (as defined in W3C
DOM Level 2 Events) or the "event" property of the "window" property (as
defined in the proprietary IE DOM).
Also the links may point anywhere, not necessarily "javascript:fn()".
You may want to read the FAQ.
i.e., can i control the links in frame1 and frame2 using a script
written in main page


Perhaps you can.
PointedEars
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: GujuBoy | last post by:
Hello All, I am farely new at PHP....I am looking for a ReDirection script with maybe the following features I need to have a "top" banner on my site with circulating banner ads so that it...
3
by: MeAgain | last post by:
Hi I have an external website link on my webpage which open like all the link in TARGET frame. since last week the external link vendor put script in his page which refresh and remove my frame....
1
by: bayouprophet | last post by:
Cant get menu script to to put linked page in the same frame. I am new to Java and I am wondering what am I doing wrong? below are my java applet file, frame.html file, and my text file and one...
13
by: Al Franz | last post by:
Anyone understand how to pass parameters to a JavaScript. If anyone finds this easy to do maybe they could take a look at my short script on this page and show me how it needs to be changed. ...
2
by: . . | last post by:
Hi I need some help with java script . I have a ASPX page that is pulling a user message heading from the table on the page . The user message header has message body which suppose to dispay...
0
by: Shadow Lynx | last post by:
When using ASP.NET 2.0's built-in TreeView on a page with <BASE target = "AnythingBut_Self"></BASE> in the HEAD, the expand/collapse buttons fail to function. The reason for this is that the...
3
by: Learner | last post by:
Hello, I have two buttons on one of my VehicleDetails.aspx page. Obiviously these two buttons takes the user to two different pages. Now my client is interested in having a linkbutton instead of...
7
by: PGPS | last post by:
Hi, I want to know who all clicked a particular link (cgi-script) on any website. 1. Link points to my own webserver 2. Link can be sent anyway. Either emailed or posted on a site which needs...
3
by: BobBlock | last post by:
This is a script that, when a link is clicked, will pull a page from somewhere and insert it in a div in the current page. Pretty simple, yes, but being the thick head I seem to be, I can't figure...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.