472,347 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Yet another Javascript and iframe question........

Hi everyone,

I am trying to create a site with pages containing iframes. This is the
first time I've used inline frames and am still struggling with the concept.

This site will have 10 pages and so far I have created 20 files, each page
having to use a pair of files. One file for the actual page, and one file
for the content of the inline frame.

It sounds bloody silly to me but then again I am only a beginner at web
devel. The tag I use for these pages look a bit like this:

<iframe name="frame" height="409" width="580" border="0" frameborder="0"
src="sub_contact.html" scrolling="auto"> Sorry, we're having
problems</iframe>

Is there any way I can use Javascript to detect what button/link has just
been clicked, and assign the appropriate value to the "src" variable? Then
perhaps I can only use one file for the actual page, and 10 files for each
content of the inline frames?

I hope this question makes some sense. I come from a programming background
but never web apps or anything remotely to do with dynamic web pages. Never
touched Javascript either!

Any suggestions or pointers (no puns intended) would be immensely
appreciated.

Cheers,
Dany.
Jul 20 '05 #1
3 3124


Dany P. Wu wrote:
I am trying to create a site with pages containing iframes. This is the
first time I've used inline frames and am still struggling with the concept.

This site will have 10 pages and so far I have created 20 files, each page
having to use a pair of files. One file for the actual page, and one file
for the content of the inline frame.

It sounds bloody silly to me but then again I am only a beginner at web
devel. The tag I use for these pages look a bit like this:

<iframe name="frame" height="409" width="580" border="0" frameborder="0"
src="sub_contact.html" scrolling="auto"> Sorry, we're having
problems</iframe>

Is there any way I can use Javascript to detect what button/link has just
been clicked, and assign the appropriate value to the "src" variable? Then
perhaps I can only use one file for the actual page, and 10 files for each
content of the inline frames?


Learn HTML, you can use a link with a target attribute set to the frame
name, thus if you have
<iframe name="iframeName"
then you use links alike
<a target="iframeName" href="whatever.html">
to load pages into the iframe. No need for JavaScript
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:3f********@olaf.komtel.net...

Learn HTML, you can use a link with a target attribute set to the frame
name, thus if you have
<iframe name="iframeName"
then you use links alike
<a target="iframeName" href="whatever.html">
to load pages into the iframe. No need for JavaScript


Hi Martin,

Thanks for the reply but that's not quite what I wanted. My apologies for
not explaining properly.

I realised you can create a link with an iframe as the target. What I was
after is a link on a particular page (page1), which loads another page
(page2) with the appropriate content displayed in an iframe in page2. The
content of the iframe on page two is dependent on the button clicked on
page1.

Is this possible?

Cheers,
Dany.
Jul 20 '05 #3
Dany P. Wu wrote:
What I was after is a link on a particular page (page1), which loads
another page (page2) with the appropriate content displayed in an iframe
in page2. The content of the iframe on page two is dependent on the
button clicked on page1.

Is this possible?


Unless you are not violating the Same Origin Policy, it is. All you need
is to follow the DOM tree down to the target IFrame object using the
frames[...] collection.
HTH

PointedEars
Jul 20 '05 #4

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

Similar topics

6
by: S'fly | last post by:
Hi, I'm struggling with the famous "gatekeeper" a little. Normally, it opens in a popup window, and from there it goes on. But I like this script...
4
by: PiedmontBiz | last post by:
Greetings I have written an online survey with 110 questions. I use javascript to cycle thru all the questions which are displayed in an iframe....
4
by: seans | last post by:
Hi, Is there some way from preventing the JavaScript code in a document loaded into an iframe from executing? I don't have access to the pages...
7
by: unacoder | last post by:
Is it possible to request the user's permission to be able to control IE or FireFox windows that are pointed to domains other than the base domain...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
18
by: Chris Ianson | last post by:
Hi geniuses (or is that genii, or genies) The challenge is as above really. I have a page with an iframe in it, and need to call a JS function...
6
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without...
16
by: Phlip | last post by:
Javascripters: I have a page with an iframe inside. Let's say the iframe looks like this: <script src="/javascripts/prototype.js"...
15
by: Phlip | last post by:
Javascripters: I have an outer page and an inner iframe. The outer page calculates some javascript, and wants the inner frame to run it. The...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.