Is there a way to open a web in my iframe and also make it auto scroll to it?
In other words...
I want to know how to combine this:
<a href="/example" target="myframe">
With this:
<a href="#myframe">
Thank you!
I dont want it to scroll within the iframe to an anoche within the target html. as a matter of fact the iframe doesnt have scrolling allowed. I want to scroll in the parent (root web) to the iframe
Yes, you do that by putting the document fragment identifier (the thing starting with the # sign) after the URL, like this:
<a href="/example#myframe" target="myframe">
To have this work, your page (example
in this case) must have a named anchor like this:
<a name="myframe">...
I found this solution. Works perfectly.
<a href="javascript:void(0)" onclick="IFrameScroll('http://www.asdf.com')">Class Name</a>
<script type="text/javascript">
function IFrameScroll(link){
window.myIframe.location=link;
window.location.hash='myIframe'
}
</script>