PDA

View Full Version : enable/disable links



Simply Me
02-28-2008, 01:41 AM
Hi! Anyone can help in enabling and disabling a hyperlinks?
I found this script but it wont fit my need so it needs to be fix. Any help is much appreciated. Thanks in advance!

<script language="Javascript">
function disableAnchor(obj, disable){
if(disable){
var href = obj.getAttribute("href");
if(href && href != "" && href != null){
obj.setAttribute('href_bak', href);
}
obj.removeAttribute('href');
obj.style.color="gray";
}
else{
obj.setAttribute('href', obj.attributes
['href_bak'].nodeValue);
obj.style.color="blue";
}
}
</script>


<body>
<a href="testing.html" onclick="javascript:disableAnchor(this, true)">individuals</a>
| <a href="#" onclick="javascript:disableAnchor(this, true)">groups</a>

</body>

Here is the scenario:
I have 5 links namely Home | Pre-test | Lesson | Post-test | About. On load of my page only the following are hyperlink enabled Home, Pre-test and About. When the user will click the Pre-test link, Page will display containing a .swf file where the user will take a test. In that same page is a link going back to Home page. I'd like that when the user clicks the Home link in the Pre-test page, the Home Page will display but the Lesson link is now enabled and the Pre-test link is now disabled.

Now that the Lesson link is enabled. My other concern is after the user had read the lesson, how should i enable the Post-test link and disable the Lesson link.

Summary of links:
First load of the page links enabled are:
Home | Pre-test | Lesson | Post-test | About

After Pre-test's Home link is clicked:
Home | Pre-test | Lesson | Post-test | About

lastly, after reading the lesson:
Home | Pre-test | Lesson | Post-test | About

Simply Me
02-28-2008, 11:46 PM
anyone who has an idea on how to do this?

zaphod42
02-29-2008, 01:37 AM
I ran into a similar problem and solved it by building a function that grabs the innerHTML of the parent, parses out the string so only the child remains, and parses out the href, then resets the innerHTML to the original string less the href...it seems like there should be an easier way, but this is what I ended up using...

Simply Me
02-29-2008, 02:02 AM
can you post code here?

zaphod42
02-29-2008, 09:18 PM
you may consider using your javascript to set the link initially instead of setting it in html and then changing it...it's easier to change anything you set in javascript because you can assign it as an object or property of an object for easier reference to it later(this isn't generally recommended by everyone, but I take Object Oriented very literally in all of my script).
here is something you can mess around with that might help...
thank you DevGuru for this...

myString = new String("DevGuru.com")
document.write (myString.link(www.devguru.com))

Simply Me
03-02-2008, 04:35 AM
this is what i have so far from other forum....The code below partially answers my query. Note that this is used in frameset.

<html>
<head>
<script language="javascript" type="text/javascript">
window.onload = firstLoad;
function firstLoad() {
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "grey";
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "grey";
}
function clickHome() {
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").style.color = "grey";
document.getElementById("lesson").href = "lesson.html";
document.getElementById("lesson").style.color = "";
}
function lessonRead() {
document.getElementById("posttest").href = "posttest.html";
document.getElementById("posttest").style.color = "";
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "grey";
}
</script>
</head>
<body>
<a href="home.html" id="home" onClick="clickHome()" target="main">Home</a> |
<a href="pre-test.html" id="pretest" target="main">Pre-test</a> |
<a href="lesson.html" id="lesson" target="main">Lesson</a> |
<a href="post-test.html" id="posttest" target="main">Post-test</a> |
<a href="about.html" id="about" target="main">About</a> |
</body>
</html>
The code cannot simultaneously remove two href attribute at the same time. Can this be done?

zaphod42
03-02-2008, 06:10 PM
first of all I'm going to assume that you have your function using onLoad for testing purposes... Second why is the third set of your function different from the others? If you set the href to blank " " it may achieve an easier effect, if not, just loop through the function with different elements.

zaphod42
03-02-2008, 06:15 PM
it would also behoove you to consider not changing your hrefs....look into using CSS to set end change all of this rather than altering your html

jscheuer1
03-02-2008, 07:19 PM
You cannot disable a link with css alone, or even in conjunction with javascript, without some pretty tricky maneuvering of stacked elements. However, with javascript alone, and without messing with the href, you can change whether or not the onclick event of a link returns true or false. If it returns true, the href will execute, false, the href will be skipped.

zaphod42
03-02-2008, 09:34 PM
Disabling the link is probably much more work than it's worth, but you absolutely can change the css with javascript. And you seem to be right that you can't DISABLE the link in css at all, but the user doesn't have to know that...and while you can set the return:false, I like to avoid that when possible because it allows you to separate interface from functionality in your javascript.

The changeLinkJavascript goes on page load to check all the links and change link styling for the link that points to the current page, and sets the href to point to said links anchor rather than taking you off the page or reloading it.

The changeLinkCSS function is just an example of how to change your CSS class to mimic turning off the link.


<head>
<title>Link Test</title>
<script type="text/javascript">
function changeLinkJavascript(){
A=document.links.length;
currURL=window.location;
alert("your current URL is "+currURL);
for(i=0;i<=A;i++){
test="not this page";
el=document.links[i];
currHREF=el.href;
if(currURL==currHREF){
test="this page";
el.href=currHREF+"#"+el.id;
el.style.color="grey";
el.style.textDecoration="none";
el.style.cursor="text";
}
alert("the "+el.id+" anchor points to "+currHREF+" which is "+test);
}
}
function changeLinkCSS(el){
alert("change "+el.id+" class from "+el.className)
var newClass='testLink2';
if(!(el.className==newClass)){
el.className=newClass;
}
}
</script>
<style type="text/css">
.testLink{}
.testLink2{}
a.testLink:link{color:blue;text-decoration:underline;}
a.testLink:active{color:blue;text-decoration:underline;}
a.testLink:visited{color:red;text-decoration:underline;}
a.testLink:hover{color:red;text-decoration:underline;}
a.testLink2:link{color:grey;text-decoration:none;}
a.testLink2:active{color:grey;text-decoration:none;}
a.testLink2:visited{color:grey;text-decoration:none;}
a.testLink2:hover{color:grey;text-decoration:none;}
</style>
</head>
<body onLoad="changeLinkJavascript();">
<a href="home.html" class="testLink" id="home" onClick="changeLinkCSS(this)" target="main">Div Example</a> |
<a href="pre-test.html" id="pretest" target="main">Pre-test</a> |
<a href="lesson.html" id="lesson" target="main">Lesson</a> |
<a href="post-test.html" id="posttest" target="main">Post-test</a> |
<a href="about.html" id="about" target="main">About</a> |
</body>
Remember....javascript is OBJECT ORIENTED, so whenever possible you should use it as such.

zaphod42
03-02-2008, 10:43 PM
oops, this will work better...

function changeLinkJavascript(){
A=document.links.length;
currURL=window.location.href;
for(i=0;i<A;i++){
test="not this page";
el=document.links[i];
currHREF=el.href;
if(currURL.indexOf(currHREF)>-1){
test="this page";
el.href=currHREF+"#"+el.id;
el.style.color="grey";
el.style.textDecoration="none";
el.style.cursor="text";
}
}
}
function changeLinkCSS(el){
var newClass='testLink2';
if(!(el.className==newClass)){
el.className=newClass;
}
}

Simply Me
03-03-2008, 12:13 AM
thanks for your reply zaphod42. How do i turn back on the href?

zaphod42
03-03-2008, 06:51 AM
You have a few options, but first of all, if you have that same script and links section at the top of each page it will never turn the href off unless the page you are currently on is the same as your href. if you need to turn specific href's off based on inheritance you can use an if check to see if the page you are on is a child(sub directory) of another page, and gray out the link to the parent....play with it a bit, look on quirksmode.org and devguru.com and check out your cross browser compatibility and syntax. That's as much as I can help without charging you as a customer;)

Simply Me
03-03-2008, 07:30 AM
I'm using frameset with this one. Perhaps just think of it as a little advance Christmas gift from you :) :D.

Kidding aside I really need to know how it should be done as i've been with this stuff for sometime now.

Thanks

Simply Me
03-03-2008, 07:33 AM
actually the script i posted in post #6 works for me although not 100% as it cannot simultaneously disable/remove two href at the same time, e.g. the function firstload() only disable the href of elementid "lesson" but not the "posttest". Here's the script once again.

<html>
<head>
<script language="javascript" type="text/javascript">
window.onload = firstLoad;
function firstLoad() {
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "grey";
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "grey";
}
function clickHome() {
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").style.color = "grey";
document.getElementById("lesson").href = "lesson.html";
document.getElementById("lesson").style.color = "";
}
function lessonRead() {
document.getElementById("posttest").href = "posttest.html";
document.getElementById("posttest").style.color = "";
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "grey";
}
</script>
</head>
<body>
<a href="home.html" id="home" onClick="clickHome()" target="main">Home</a> |
<a href="pre-test.html" id="pretest" target="main">Pre-test</a> |
<a href="lesson.html" id="lesson" target="main">Lesson</a> |
<a href="post-test.html" id="posttest" target="main">Post-test</a> |
<a href="about.html" id="about" target="main">About</a> |
</body>
</html>

zaphod42
03-03-2008, 08:23 AM
Okay, I missed the frameset mention, the important thing to remember about javascript is that if all of your script is created using the same method it will increase long term functionality, not to mention your understanding of how everything is actually working. The previously posted script can absolutely apply to a frame page with a little bit of work, look at those links I posted earlier, you can grab the url of a frame just like the window, and tell JS to run that same function every time a link is clicked. Consider what else this might be used for and integrate it into your code as needed. If you want to store values after a function is run, remember again that javascript is an OBJECT ORIENTED language and as such gives you the ability to create objects and properties of ANY objects using values that you decide, and you need only define them for them to exist.

Simply Me
03-03-2008, 12:10 PM
As mentioned in my earlier post, I just need to make the "Lesson" and "Post test" disabled during on load of a page. The "Lesson" link will just be enabled after the user will have taken the "Pre-test" (this is already done using the code posted above). My only problem are:

1. Make the "Lesson" and "Post Test" links disabled during on load and
2. After the user had read the content of the Lesson page, it will be disabled again but this time the "Post test" link now be enabled so that user can the test.

Can you post me the corrected code of my above posted code?

jscheuer1
03-03-2008, 02:41 PM
The main problem with your 'working' code is that there is no color grey in IE. This causes an error and ends processing before the second link is disabled. Use gray.

Simply Me
03-04-2008, 04:39 AM
The main problem with your 'working' code is that there is no color grey in IE. This causes an error and ends processing before the second link is disabled. Use gray.


PERFECT!!! it works....

Simply Me
03-04-2008, 05:27 AM
OK...I changed the grey into gray and the issue this time is that when I click the Pretest link, the html file is not loading into frame. The code is like this now.

<html>
<head>
<script language="javascript" type="text/javascript">
window.onload = firstLoad;
function firstLoad() {
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "gray";
}
function clickHome() {
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").style.color = "gray";
document.getElementById("lesson").href = "lesson.html";
document.getElementById("lesson").style.color = "";
}
function lessonRead() {
document.getElementById("posttest").href = "posttest.html";
document.getElementById("posttest").style.color = "";
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";
}
</script>
</head>
<body>
<a href="home.html" id="home" onClick="clickfirstload()" target="main">Home</a> |
<a href="pretest.html" id="pretest" onClick="clickHome()" target="main">Pre-test</a> |
<a href="lesson.html" id="lesson" target="main">Lesson</a> |
<a href="posttest.html" id="posttest" target="main">Post-test</a> |
<a href="about.html" id="about" target="main">About</a> |
</body>
</html>

Simply Me
03-04-2008, 05:49 AM
If i remove this onClick="clickHome()" it ,the link will work but if it is present it won't work. This is what i have in my pretest.html

<div style="width:600px; height:500px; float:left; margin-left:20px">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"

width="600" height="500">
<param name="movie" value="pretest.swf" />
<param name="quality" value="high" />
<embed src="pretest.swf" quality="high"

pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"

width="600" height="500"></embed>
</object><br />


<a href="content.html" target="main">Home</a>

jscheuer1
03-04-2008, 05:53 AM
You are removing the href before it gets a chance to execute. If you are using that code, and you want the link to still fire until it disables itself, here's one way to do that (assuming this is in a frameset and that the frameset with 'main' is this page's parent page:


<html>
<head>
<script language="javascript" type="text/javascript">
window.onload = firstLoad;
function firstLoad() {
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "gray";
}
function clickHome() {
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").onclick=function(){return;};
document.getElementById("pretest").style.color = "gray";
document.getElementById("lesson").href = "lesson.html";
document.getElementById("lesson").style.color = "";
}
function lessonRead() {
document.getElementById("posttest").href = "posttest.html";
document.getElementById("posttest").style.color = "";
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";
}
</script>
</head>
<body>
<a href="home.html" id="home" onClick="clickfirstload()" target="main">Home</a> |
<a href="pre-test.html" id="pretest" onclick="parent.frames['main'].location=this.href;clickHome();return false;" target="main">Pre-test</a> |
<a href="lesson.html" id="lesson" target="main">Lesson</a> |
<a href="post-test.html" id="posttest" target="main">Post-test</a> |
<a href="about.html" id="about" target="main">About</a> |
</body>
</html>

Simply Me
03-04-2008, 07:59 AM
WOW it's great!

Now i have another question... When I clicked the Pretest link it works but why is it that when I click Home again the Pretest link is not enabled again even if i click the refresh button of the browser. it should look like this again Home | Pre-test | Lesson | Post-test | About....here is my code


<html>
<head>
<script language="javascript" type="text/javascript">
window.onload = firstLoad;
function firstLoad() {
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "gray";
}

function clickHome() {
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").onclick=function(){return;};
document.getElementById("pretest").style.color = "gray";
document.getElementById("lesson").href = "lesson.html";
document.getElementById("lesson").style.color = "";
}

function lessonRead() {
document.getElementById("posttest").href = "posttest.html";
document.getElementById("posttest").style.color = "";
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";
}

function FinishedPretest() {
document.getElementById("lesson").href = "posttest.html";
document.getElementById("lesson").style.color = "";
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").style.color = "gray";
}
</script>
</head>
<body>
<a href="content.html" id="home" onClick="clickfirstload()" target="main">Home</a> |

<a href="pretest.html" id="pretest" onclick="parent.frames['main'].location=this.href;clickHome();return false;" target="main">Pre-test</a> |

<a href="lesson.html" id="lesson" target="main">Lesson</a> |

<a href="posttest.html" id="posttest" target="main">Post-test</a> |

<a href="about.html" id="about" target="main">About</a> |
</body>
</html>

jscheuer1
03-04-2008, 01:30 PM
What you are now asking about involves this link:


<a href="content.html" id="home" onClick="clickfirstload()" target="main">Home</a>

There is no clickfirstload(), and refreshing a frameset often just reloads the pages that were already in it at that point, often without running any of their scripts.

The easiest way to get back to the first loaded state would be to navigate directly back to the frameset, if its default pages are what you are after. Let's say its name is index.html:


<a href="index.html" id="home" onclick="top.location=this.href;return false;" target="_top">Home</a>

Otherwise, you would need to devise a clickfirstload() function that puts everything the way that you want it.

Simply Me
03-05-2008, 01:03 AM
What you are now asking about involves this link:


<a href="content.html" id="home" onClick="clickfirstload()" target="main">Home</a>

There is no clickfirstload(), and refreshing a frameset often just reloads the pages that were already in it at that point, often without running any of their scripts.

I have solve this one last night at home. I mislooked at the firstload().


The easiest way to get back to the first loaded state would be to navigate directly back to the frameset, if its default pages are what you are after. Let's say its name is index.html:


<a href="index.html" id="home" onclick="top.location=this.href;return false;" target="_top">Home</a>

Otherwise, you would need to devise a clickfirstload() function that puts everything the way that you want it.

My code below works except that when i cycle through the links until such a time that the Pretest link is enabled again, and when i click on it, it will not be disabled again... I have to click the Home link first before clicking the Pretest link in order for the link to act the same way when the page is first loaded.

Here's the load:


<html>
<head>
<title>Untitled Page</title>

<script language="javascript" type="text/javascript">

window.onload = firstLoad;
function firstLoad() {
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";

document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "gray";
}

//this function is use when Home or Posttest link is clicked
function clickHome() {
//disable lesson link if enabled
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";

//disable posttest link if enabled
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "gray";

//enable pretest link if disabled
document.getElementById("pretest").href = "pretest.html";
document.getElementById("pretest").style.color = "";
}

function clickPretest() {
//disable pretest link if enabled and display pretest.html
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").onclick=function(){return;};
document.getElementById("pretest").style.color = "gray";

//disable posttest link if enabled
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "gray";

//enable lesson link if disabled
document.getElementById("lesson").href = "lesson.html";
document.getElementById("lesson").style.color = "";
}

function clickLesson() {
//disable lesson link if enabled and display lesson.html
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").onclick=function(){return;};
document.getElementById("lesson").style.color = "gray";

//disable pretest link if enabled
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").style.color = "gray";

//enable posttest link if disabled
document.getElementById("posttest").href = "posttest.html";
document.getElementById("posttest").style.color = "";
}

</script>
</head>
<body>

<a href="index.html" id="home" onclick="top.location=this.href;return false;" target="_top">Home</a>

<!--<a href="content.html" id="home" onclick="parent.frames['main'].location=this.href;clickHome();return false;" target="main">Home</a> -->|

<a href="pretest.html" id="pretest" onclick="parent.frames['main'].location=this.href;clickPretest();return false;" target="main">Pre-test</a> |

<a href="lesson.html" id="lesson" onclick="parent.frames['main'].location=this.href;clickLesson();return false;" target="main">Lesson</a> |

<a href="posttest.html" id="posttest" onclick="parent.frames['main'].location=this.href;clickHome();return false;" target="main">Post-test</a> |

<a href="about.html" id="about" target="main">About</a>


</body>
</html>

<!--<b><i>Home | Pre-test | Lesson | Post-test | About</i></b>-->

jscheuer1
03-05-2008, 06:17 AM
Your code is getting a bit too complex for me to easily follow, but when you do something like so:


document.getElementById("pretest").onclick=function(){return;};

You are removing/overwriting this (the highlighted onclick event):


<a href="pretest.html" id="pretest"
onclick="parent.frames['main'].location=this.href;clickPretest();return false;"
target="main">Pre-test</a>

from the pretest link. If you want to be able to keep the event, and control whether or not it does certain things, you could give it a property - say, approved.


<a href="pretest.html" id="pretest"
onclick="if(this.onclick.approved){
parent.frames['main'].location=this.href;clickPretest();
}
return false;" target="main">Pre-test</a>

Now it won't do anything until we enable it in the onload:


window.onload = firstLoad;
function firstLoad() {
document.getElementById("lesson").removeAttribute("href");
document.getElementById("lesson").style.color = "gray";
document.getElementById("pretest").onclick.approved=true;
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "gray";
}

And instead of overwriting it to disable it, we can now do this:


function clickPretest() {
//disable pretest link if enabled and display pretest.html
document.getElementById("pretest").removeAttribute("href");
document.getElementById("pretest").onclick.approved=false;
document.getElementById("pretest").style.color = "gray";

//disable posttest link if enabled
document.getElementById("posttest").removeAttribute("href");
document.getElementById("posttest").style.color = "gray";

//enable lesson link if disabled
document.getElementById("lesson").href = "lesson.html";
document.getElementById("lesson").style.color = "";
}

Later, wherever you want to re-enable it, just (in addition to changing the link's color and restoring its href) do:


document.getElementById("pretest").onclick.approved=true;

again.

Simply Me
03-05-2008, 06:51 AM
if i do that the pretest link wont be disabled anymore and it wont display the html file it is supposed to load/display in my 'main' frame.

This is what i am doing.
1. load the page (index.html)
2. I click Pretest link, It loads pretest.html, disable pretest link and enable lesson link.
3. I click Lesson link, it loads lesson.html, disable lesson link and enable posttest link.
4. I click Posttest link, it loads posttest.html, disable posttest link, enable Pretest link.

In the code I posted that cycle is running perfectly. The only problem occurs after clicking posttest link. When it is clicked (Posttest) the nav.html links that are enabled are the following HOME, PRETEST and ABOUT (These are the same links enabled on load the page) but this time when pretest link is click it will not be disabled anymore ( I mean the cycle that I have enumerated above is not perform anymore. Unless I click HOME first before clicking PRETEST).

Simply Me
03-05-2008, 07:42 AM
Right now, what i did to solve the problem is, I just added another function and named it as clickPosttest() where i disabled the pre-test link instead of having it enabled thereby forcing the user to click the home link in order for the pretest link perform just like how it used to be on first load of the page. I know its not a good work-around but in this way it worked the way i like my page to work.

If anyone can possibly recommend other way to do this then i am very much happy for it.

Many thanks jscheuer1

jscheuer1
03-05-2008, 01:24 PM
Yes, often when your code gets that complex, it means you are doing it wrong. Not always though. But, for example, if you find that you have many similar functions where just the id or ids of the elements you are acting upon differs, you can make just one function and call it with the id or ids as parameters (arguments). Or, if you find you are doing a similar set of things over and over, make a sub-routine function to do that and call it whenever it is required from your main function(s).

Also, as inline events become more complex, you can make up a named function for them to get most of their code out of the body and into the head.

If I get a chance, I will look over your code to see what economies can be made. Up until now, I was primarily just concerned with getting it to do what you wanted it to do.

Before I do that, just what code are you using at this point?

zaphod42
03-05-2008, 01:43 PM
Weary as I am to come back after being called out about a misspelled color...

var linkStates=new Object();
function changeLink(el){
pre=document.getElementById('pretest');
les=document.getElementById('lesson');
post=document.getElementById('posttest');
linkStates.currentFrame=el.id;
el.style.color="gray";
el.style.textDecoration="none";
el.style.cursor="text";
switch(el.id){
case "pretest":
les.style.color="blue";
les.style.textDecoration="underline";
les.style.cursor="pointer";
break;
case "lesson":
post.style.color="blue";
post.style.textDecoration="underline";
post.style.cursor="pointer";
break;
case "posttest":
pre.style.color="blue";
pre.style.textDecoration="underline";
pre.style.cursor="pointer";
break;
}
}
Maybe it will help

zaphod42
03-05-2008, 01:48 PM
oops again...to disable the links have you tried just adding document.getElementByID('pretest').onclick=function(){return false;}? I use this regularly when cycling through a series of clickable objects on a page.

Simply Me
03-06-2008, 12:11 AM
Before I do that, just what code are you using at this point?

Basically, What I have right now is just like the one i attached in my post. I want to make sure first that the link will act the way i want it. I'll be making the rest of the content of my page.

Simply Me
03-06-2008, 12:17 AM
oops again...to disable the links have you tried just adding document.getElementByID('pretest').onclick=function(){return false;}? I use this regularly when cycling through a series of clickable objects on a page.

In the attached file there is something like that in it.