Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 18th, 2005, 01:51 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Alhambra, ca, USA.
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default Easy hyperlink ques with iframe

Hello
I have a menu on the left with hyperlinks. On the right I have a <iframe> where I want to switch to different .htm files as the user clicks on the menu hyperlinks.

I got this to work with image menu items rather than hyperlinks. But I can't get it to work with hyperlinks.

Below code is what I used for image menu items.

<SCRIPT LANGUAGE="JavaScript">
function cFs(NewSource)
{
var oFrame = document.getElementById("fraContent");
oFrame.src = NewSource;
}
</SCRIPT>

<img src="images/x.gif" onclick="cFs('6_p1.html');" name="x">

<iframe id="fraContent" src="somepage.html" ></iframe>


How can I get this to work with <a href> tag??

Thank you.
Reply With Quote
  #2 (permalink)  
Old September 18th, 2005, 03:52 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well if your <a> has the page to show in the href and the iframe has a name of fraDisplay then pure HTML with no JavaScript is sufficient:
Code:
<a href="6_p1.html" target="fraDisplay">6_p1.html</a>
otherwise you will have to tell us what you need and what you mean when you say that it dosn't work.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old September 18th, 2005, 12:11 PM
Friend of Wrox
 
Join Date: Jun 2004
Location: Alhambra, ca, USA.
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello joefawcett,

I am trying to have the iframe (on the right)load different htm pages according to which left menu hyperlink is clicked. If the user clicks <a href="??">6_p1.html</a> then I want the iframe on the same page load up 6_p1.html. I don't want the hyperlink poping up another window.

I believe this can only be done with Javascript. Thank you.
Reply With Quote
  #4 (permalink)  
Old September 19th, 2005, 04:47 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Don't believe me then :)

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #5 (permalink)  
Old September 21st, 2005, 02:45 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii bekim!!
Try this

script>
function cFs(NewSource)
{

  var oFrame
oFrame = document.getElementById("fraContent");
  oFrame.src = NewSource;
}
</script>
<a href="javascript:cFs('a1.html')">Test1</a> <br>
<a href="javascript:cFs('a2.html')">Test2</a><br>
<a href="javascript:cFs('a3.html')">Test3</a><br>



<iframe id="fraContent" src="somepage.html" ></iframe>

Hope this will help you

Cheers :)

vinod
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy Ques -- Datetime validation for Access bekim Access 2 June 16th, 2005 01:52 PM



All times are GMT -4. The time now is 12:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.