getelementsbytagname returns a collection (kind of like an array) so it is best to loop through it, even if you know it is only one element.
also, when converting css tags that have a hyphen into DOM commands (I have no idea if I have the terminology right here, but bear with me) they generally become camel case, so font-size becomes fontSize. try this:
Code:
<!html>
<head>
</head>
<body>
<font size="5">Text that's too big</font>
<input type="button" value="click me!" onclick="changeSize()">
<script type="text/javascript">
function changeSize(){
var title = document.getElementsByTagName('font');
for(i=0;i<title.length;i++){
if (title[i].size == '5') {
title[i].style.fontSize = '12pt';
}
}
}
</script>
</body>
</html>
Bookmarks