Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using an anchor from URL to in a child frame 1

Status
Not open for further replies.

cresbydotcom

Technical User
May 22, 2006
234
Hi

Problem - the calling site links to me with #anchors and acts as you would expect in a page without frames. eg dance.htm#D.DJ

This code works well in IE5 but not in Mozilla 1.7.8 and Opera 3.5 seems to ignore it as well.

Code:
<script language="JavaScript" type="text/JavaScript">
var inanchor = self.location+parent.location.hash;
self.location.replace(inanchor)
</script>

I have tried scroll() but in various ways but to no avail.

The intention is to make it work with legacy browsers (except possibly K-melon or whatever it is called) because my target audience is still fairly Luddite in parts.

Any ideas on browser handling? Places to look?

there is a tide in the affairs of man that you Cnut ignore.................
 
Surely Opera 3.5 and IE 5 are extremely outdated browsers now (given we've had IE 5.5, IE 6, IE 7, IE 8 beta 1, and Opera 4, 5, 6, 7, 8, and 9)... So maybe it's time to update your browser compatibility matrix to use modern browsers?

I suggest IE 6 and Opera 7 or 8 as a minimum. Anything older just isn't worth the hassle any more.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
re-emphasise the luddite remark. Target audience. Using broadband and IE 7 isn't going to alert me to their problems is it? I see all sorts of inanity when using the legacy browsers to look at other peoples' sites. Not addressing their problem is my fault not theirs. Even one problem affects only 1% of Folkies - there are many problems and that becomes many %. Lowest common denominator is LOW.

The JavaScript instructions I can't seem to find are really those that would effectively operate as if a link to an anchor had been clicked.

Any ideas anyone? I tried scroll() and ScrollTo()

The code above is re-entrant! so never stops, and doesn't work as needed.

TIA

there is a tide in the affairs of man that you Cnut ignore.................
 
Assuming you're using something like this:

Code:
<a name="D.DJ"></a>

them you could possibly try giving focus to the anchor:

Code:
<script language="JavaScript" type="text/JavaScript">
   var theAnchors = document.getElementsByName(parent.location.hash);
   if (theAnchors.length) {
      theAnchors[0].focus();
   }
</script>

I'm not sure if that'll work or not on older browsers, but you never know.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I'll give it a try. I will have to consult my bible "Pure JavaScript".

What I forgot to say - but is probably obvious, it is all client side.

Thanks



there is a tide in the affairs of man that you Cnut ignore.................
 
Tried a lot of things in the first child frame (nothing doing in the frameset/holding html doc).

I have come to the conclusion that it would be better to re-structure the anchors into HTML docs and call them individually from links &/or JavaScript.

That begs another question because there is a website that collects my data with a web-bot. So I need to check on the consequences.

Thanks for your help.

there is a tide in the affairs of man that you Cnut ignore.................
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top