...

View Full Version : link problem



kazuri
09-29-2007, 08:31 AM
Hi everyone, Im having a bit of a problem getting a onClick to change the different link values.

Im trying to switch the black ground and link colors, but I cant figure out the right 'definition' for the link styles..

I can get this to work for the background color,
onClick="document.body.style.backgroundColor = 'white';"

But I dont know what to type after document.body.style. for the different link values, a:link v:link etc. Ive been searching google for a couple hours and just cant seem to find anything on it.

Thanks.

SouthwaterDave
09-29-2007, 09:54 AM
You won't like my choice of colours but it works otherwise:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<style type="text/css">
.xxx {background-color: #ccffcc}
.xxx a:link {color: #f00}
.xxx a:visited {color: #800080}
</style>
</head>
<body>
<div>
<a href="#">Going nowhere...</a>
<input type="button" onclick="javascript:document.body.className='xxx';" value="All change" />
</div>
</body>
</html>

kazuri
09-29-2007, 08:25 PM
Hey thanks a lot, worked like a charm!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum