Jump to content

mjohnstr

Members
  • Posts

    3
  • Joined

  • Last visited

mjohnstr's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. ty, dsonesuk i considered your code, but i'm trying to avoid jquery, etc. i found a little something that works, but it needs to be manipulated a bit to be ...exactly what i need. i'll show you what i have so far:text.js: function tarfunc() { var tar = location.hash; tar = tar.substring(1); for(var i=0; i<100; i++) { var x = document.getElementsByName(tar); x.style.background = "yellow"; }} and the body tag of every page on the site contains an "onload" method for that function.so far, this is only doing the minimum of what i need it to do, and i already know the function is poorly written(var tar = location.hash.substring(1);? and the limit[?] of the for-loop["i<100"] can probably be something more efficient. someday i might figure out how to make it so. hehe), but it highlights every "a:target"(name) that gets passed with the hashtag.the problem that i see right away is that i'm not going to want the multiple highlight every time i click a link attached to the name. ...so... i either need to "id" the link with a value common to all 'group highlight' initiations OR i need to highlight the actual ":target" with a different color than the group highlights. i'll probably pursue the latter.
  2. thx dsonesuk. yes, i was told that i should look into jquery to address this. i've tried to figure out how to do it with javascript 'manually', but i must need to take more time learning the different elements/attributes regarding the DTD or something. i didn't get very far with understanding it. i suppose i should pose this same question in a javascript forum. hehe thx again
  3. i apologize if this is a newbie question, but i'm having a lot of trouble finding a solution to this problem.i know of one way to highlight a single anchor through a link definition in the css('text.css'):a:target {background: yellow}where the target is an appropriately named anchor in a file that includes the css. for instance, in file 'target.htm', you might have a:<head><link href="text.css" media="screen" rel="Stylesheet" type="text/css"></head>followed by<body><p>won't you please <a name=bob href="http://w3schools.com">highlight me</a>.</p></body>and in the document 'highlight.htm', you might have:<p>click <a href="target.htm#bob">me</a> to highlight 'bob'.</p> in the body with the same header.BUT what i want to do is highlight multiple anchors(targets) with the same name(or 'id'?) on one click. so that, in the following instance, all of the 'bob's will be highlighted upon the loading of 'target.htm'.<p>won't you please <a name=bob href="http://w3schools.com">highlight me</a>, <a name=bob href="http://w3schools.com">and me</a>, <a name=bob href="#bob">and me</a>, <a name=bob >and me</a>, <a name=fred href="http://w3schools.com">but not me</a>.does that make sense?thank you in advance for any help. it will be greatly appreciated. i've been trying to figure this out for years, and even asked a friend who, i thought, knew this kind of stuff. i just realized i might be able to get a complete answer from a forum. ...yeah, i tend to be slow with a few things. hehe
×
×
  • Create New...