usmbay
asked on
Change font using a checkbox
Hello,
I want to change the font to strong if the checkbox checked
<input type="checkbox" name="isDefaultTemplate" value="DefaultTemplate" This a default template>
I want to change the font to strong if the checkbox checked
<input type="checkbox" name="isDefaultTemplate" value="DefaultTemplate" This a default template>
ASKER
Thanks but I want it for this phrase only " This a default template "
Oh okay, this then:
<script>
function change(value) {
if(value) document.getElementById('c ontent').s tyle.fontW eight = 'bolder';
else document.getElementById('c ontent').s tyle.fontW eight = '';
}
</script>
<input type="checkbox" onchange="change(this.chec ked)" name="isDefaultTemplate" value="DefaultTemplate"> <div id="content">This a default template</div>
<script>
function change(value) {
if(value) document.getElementById('c
else document.getElementById('c
}
</script>
<input type="checkbox" onchange="change(this.chec
ASKER
ok it changs the font but not dynamic, I mean I have to click on the text to be changed
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent, Thanks
<script>
function change(value) {
if(value) document.body.style.fontWe
else document.body.style.fontWe
}
</script>
<input type="checkbox" onchange="change(this.chec