Jump to content

Iframe to go to an "a name"


quackquack

Recommended Posts

How could we jump to a part of the website by an Iframe? I'm gonna make a templating website. . . Example:

<!--If i clicked a link with the name="1" and an "a name" in a text of a page, how could we do it by an Iframe?-->
This is the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">body{background-color: #00FF00;scrollbar-face-color:antiquewhite;scrollbar-highlight-color:red;scrollbar-3dlight-color:orange;scrollbar-darkshadow-color:brown;scrollbar-shadow-color:pink;scrollbar-arrow-color:red;scrollbar-track-color:ivory;}</style><style type="text/css">a.one:link {color: blue}a.one:visited {color: green}a.one:hover {background-color: #00FFFF}a.one:active {color: #00FF00}</style><meta name="keyword" content="HTML, CSS, templates, PHP, Font, ASP, website"><meta name="description" content="This is the best Template maker that is beneath your feet"> <title>Free Templates</title></head><body><font face="verdana"><h3>Free templates for your website</h3><hr color="#99FFFF"></font><p> </p><font face="verdana"><h6>Introduction<br>This site will make your own site a good-looking, professional, and appreciating website by templates.<br><div align="center">NOTE:</div><br>To do this, you need to copy-paste the template to a site with <a class="one" href="http://www.google.com.bh/search?hl=en&q=website+maker+with+html+editor&btnG=Search">HTML editor</a> </h6></font></body></html>

Link to comment
Share on other sites

im not entirelly sure what you mean. are you asking how, within the iframe, you can jump to a named part of the page by clicking a link external of the iframe?a normal example being:

<a href="#bottom">Click here to go to bottom</a>... long space inbetween ...<a name="bottom"></a>

your idea being:

<a href="#bottom_of_iframe"></a>... iframe code, and on the page within the iframe have ...<a name="bottom_of_iframe"></a>

.. is that what you are trying to achieve?

Link to comment
Share on other sites

gotchya. for the "Let the iframe go to a specific part of the page" i think you're going to need to use java script:

var iframe = document.frames["iframeName"];

to set the iframe as an object. then:

iframe.location = 'something.html#bottom-of-page';

.. or something like that, i'm not sure. i'll have a go at getting it to work.

Link to comment
Share on other sites

- this should really be in the javascirpt forum - but..

function iframeanchor(ifrm,acr) { var iframe = document.frames[ifrm]; iframe.location = iframe.location+acr;}

that's the function. in the link href put:

java script:iframeanchor('iframe_name', '#bottom');

- btw the forum will put a space in "java script:" .. take out the space. and don't forget the anchor (#bottom in the example above) must exist in the iframe page.

Link to comment
Share on other sites

Can't you also simply use target?

<a href="framesrc.html?#bottom-of-page" target="myFrame">Go to bottom</a><iframe name="myFrame" id="myFrame" src="framesrc.html"></iframe>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...