473,763 Members | 7,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1335
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.javas cript 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
1528
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 switches every "20sec" and if users click on it..it will open the site in a new frame and also keep track of how many times they click on that banner. is there anything similar to this? please help
3
4443
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. How can I kill this script so it stays in my target frame??? thanks the script is as below. """ <script language="JavaScript">
1
3255
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 of my link file that should load next to the menu on the same page. And Thank You in advance. Here is my menu applet: <html>
13
26988
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. http://franz.org/java.htm Thanks for any help.
2
2145
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 under the heading when a user click on the message header . Message body will come from database table .The different message header has different message body . I have got the message heading showing up on the web page . How do I show the message...
0
2558
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 hyperlinks generated for the expand/collapse buttons includes javascript code that will execute in the frame specified in the Base Target rather than the current document. To remedy this, TreeView should render a target="_self" attribute for each...
3
2772
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 the two buttons. Once the user clicks on the linkbutton a javascript dialog box popsup that says "Is the Lessee buying this vehicle?" and with two buttons "Yes" and "No". If user clicks "yes" it should go to DealerQuestions.aspx" and if "No" it...
7
1676
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 login If emailed, then the email page which shows the link also has the users name. When clicked I want to obtain the name.
3
1701
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 out how to implement it. i.e. how to formulate the link so that it will point the script to the page we want to load in the div we want? The script: $(document).ready(function() { // Check for hash value in URL var hash =...
0
9564
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9387
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.