javascript - updating an example string

Soldato
Joined
4 Jul 2004
Posts
2,647
Location
aberdeen
hello
i want to be able to have a few check boxes, that are set out like:

Bold [checkbox]
Underline [checkbox]
Italics [checkbox]

and then:
This is how it'll look

When you check the bold, it makes the "this is how it'll look" bold (by adding style="font-weight: bold"). When you untick it, it removes font-weight: bold. etc

Could anyone help please?
cheers
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR></HEAD>

<script language="javascript">

function MakeItBold()
{
if (document.all.Box1.checked)
{
test.style.fontWeight = "bold";
}
else
{
test.style.fontWeight = "normal";
}
}
</script>
<BODY>
<INPUT id=Box1 TYPE=CHECKBOX onclick="MakeItBold()">

<div id="test">This is how it will look</div>
</BODY>


</HTML>

this will do it
 
Back
Top Bottom