hello,
I have modified your code to help achieve your objective. Here are few thing to keep in mind.
- JavaScript is case sensitive.
- If you new to JavaScript, read more about it from the web (use Google)
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function setFont()
{
var selectFont = document.getElementById("font");
if (selectFont) {
var selectFontValue = selectFont.options[selectFont.selectedIndex].value;
if (selectFontValue == "Bold Italic") {
document.getElementById("Text10").style.font = "italic bold 12px arial,serif";
}
else if (selectFontValue == "Plain") {
document.getElementById("Text10").style.font = "12px arial,serif";
}
else if (selectFontValue == "Bold") {
document.getElementById("Text10").style.font = "bold 12px arial,serif";
}
else {
document.getElementById("Text10").style.font = "italic 12px arial,serif";
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Text10" type="text"/>
<select id ="font">
<option value="Plain">Plain</option>
<option value="Bold">Bold</option>
<option value="Italic">Italic</option>
<option value="Bold Italic">Bold Italic</option>
</select>
<input type="button" onclick="setFont()" value="Change font" />
</div>
</form>
</body>
</html>