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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a hyperlink unclickable 2

Status
Not open for further replies.

rushie84

Programmer
Jul 31, 2003
8
0
0
US
I have a page with 2 frames. Frame one is a Navigation frame with a bunch of links, and frame two displays the pages that the links call. I would like for the link for the page showing in frame two to not be clickable. Here is what I have so far:

An example of a link in the navigation page:
<a href=&quot;#&quot; onClick=&quot;return parent.frames['welcomeframe'].checkLinks('welcome.html')&quot;>Welcome</a>

The function that is in each page that opens in frame two:
function checkLinks(thisLink){
var lgn = document.links.length;
var k = 0;

for(k = 0; k < lgn; k++){
alert(document.links[k]);
if (thisLink == document.links[k]){
alert(thisLink+ &quot; is on this page also.&quot;);
return false;
}
}
document.location.href = thisLink;
return;
}

Any help is great. Thanks
 
Then don't make it a link. Make it blue and underline it. Then, you will have created something that looks like a link, but isn't. And the rewards will be great...

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
if i don't make it a link, how else will it bring up a page when i click on it? I'm trying to get each link in frame one to disable itself when i click on it and that page is showing in frame two.
 
I wouldn't use links (<A> tags) at all then. You could use the <U> tag and have an onclick event handler that passes the page name to a JavaScript function. This function would see if the page name matches the last called page and if it DOESN'T then load it in the other frame.

Did that make sense?

Give the coding a shot and if you have any troubles, post what you can and someone here (maybe me) can help fill in the details.

Einstein47
(&quot;As a cure for worrying, work is better than whiskey.&quot; - Thomas Edison)
 
Well, i don't really want the text underlined. I have it where its not underlined, and it changes color onMouseOver.
 
What happens if you make your onClick resemble this:

Code:
onClick = checkFrames('welcome.html');

...and change your function to look like this:

Code:
<SCRIPT>
function checkFrames(newLoc)
{
 var fr = parent.frames['welcomeframe'];
 if(fr.location.href != newLoc)
  fr.location = newLoc;
}
</SCRIPT>

What happens then?

As a plan B, do the same thing, but take out the href=# all together. Your onMouseOver could also make the cursor the pointing-finger to make it resemble a true hyperlink.

--Dave
 
Plan A generated an error on the page. Plan B made it where none of the links had a pointer, and then created an error. I'm still trying stuff. If you have any more ideas, please let me know. Thanks
 
How about something like this?

<a href=&quot;welcome.html&quot; target=&quot;welcomeframe&quot;
onClick=&quot;return parent.welcomeframe.location.href.indexOf(this.href)==-1&quot;>Welcome</a>

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top