Click to See Complete Forum and Search --> : Can you change font onclick?


Scleppel
10-03-2004, 05:16 PM
Can you change font onclick?

Ben Rogers
10-03-2004, 06:49 PM
Yes, using JavaScript, but why would you want to? This wouldn't make for a very attractive or practical effect.

Charles
10-03-2004, 06:54 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>

<style type="text/css">
<!--
.serif {font-family:Georgia, serif}
.sansSerif {font-family:Verdana, sans-serif}
-->
</style>

</head>
<body class="serif" onclick="this.className = this.className == 'serif' ? 'sansSerif' : 'serif'">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
</body>
</html>

IncaWarrior
10-03-2004, 10:06 PM
A page that changes from serif to sans-serif when you click on the text? That sounds useful :D