Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using anchor link in active window to get to a target link in iframe.

Posted on 2003-11-13
5
Medium Priority
?
418 Views
Last Modified: 2009-07-29
If I use a plain HTML in an active window only, I can easily whip out a HTML code to accomplish this task like this...

--snip--
<html>
  <body>
  <!-- To jump from a link like this to a target link: -->
  <a href="#A">Letter "A" (Go From Letter "A')</a>

  <!-- Blah Blah Blah of a long newspaper article in HTML fonts -->

  <!-- Define the target like this: -->
  <a name="A">Letter "B" (To This Letter "B")</a>

   <!-- Blah Blah Blah of a long newspaper article in HTML fonts -->
  </body>
</html>
--snip--

This is where the user can easily jump from the top to somewhere in the middle just like that.  I'm now working on a project that would require the use of JavaScript which isn't a difficult thing to do but using this feature from above with a Letter "A" link in a main window (or a pop-up window) to jump to a Letter "B" inside of the iframe window, (even if the article in the iframe is long with a similiar effect as the one from above).  I pretty much stumped on this one because I don't know what to look for to use a handle like this in JavaScript and in iframe.

Thanks,
 Scott Fletcher
0
Comment
Question by:fletchsod
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
Codescripter earned 500 total points
ID: 9741655
fletchsod try this:

-------------------------------------------------------------------------------------------
<script language="JavaScript">
function LoadSearch(strSearch) {
  doc.location = "http://www.yourserver.com/yourpage.htm#" + strSearch;
}
</script>


<iframe id="doc" name="doc" frameborder="1" scrolling="yes" width="100%" height="100%" src="http://www.yourserver.com/yourpage.htm"></iframe>

-------------------------------------------------------------------------------------------

  - or this -

-------------------------------------------------------------------------------------------
<a href="http://www.yourserver.com/yourpage.htm#strSearch" target="doc">Jump</a>

<iframe id="doc" name="doc" frameborder="1" scrolling="yes" width="100%" height="100%" src="http://www.yourserver.com/yourpage.htm"></iframe>
-------------------------------------------------------------------------------------------
0
 

Author Comment

by:fletchsod
ID: 9742270
That does help.  From the look of the example posted by Codescripter.  It does work and it doesn't look too difficult, the bottom half work very nicely for a main window.  Was able to use the top half example and tweak it to work with the popup window and it does work. (Just convert it from PHP to HTML/JavaScript...) So, giving points to Codescripter right after this post.

--snip--
<!-- PopUp Window Script -->
<script type='text/javascript'>
parent.window.opener.document.getElementById('DivBillInfoIframe').innerHTML = 'One moment while Iframe is refreshing itself!!';
opener.parent.frames['BillingInfo_IFrame'].location.reload();
opener.parent.frames['BillingInfo_IFrame'].location.href='https://www.domain.com/billing_info_iframe.php#RowNum5';
</script>

<!- Iframe Window -->
<a href="#" name="RowNum5">Test</a>
0
 

Author Comment

by:fletchsod
ID: 9742285
Thanks for your help!!!

Scott F.
0
 
LVL 2

Expert Comment

by:Codescripter
ID: 9742649
Thanks for the points, fletchsod.  
From the look of your example code, you seem to know what you're doing.  =)

~Codescripter
0
 

Author Comment

by:fletchsod
ID: 9744051
Been doing HTML, JavaScript and PHP for 4 years at my job.  :-)  Just came upon this situation and wasn't sure how to handle the link anchor.  Have been doing a lot of writing for popup window and iframes in the last 6 months, so they come in handy.  Cheers.

Scott F.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question