<html>
<head>
<title>String Object Formatting</title>
<script language="JavaScript1.1" type="text/javascript">
<!--
function showWindow() {
var txt = document.form1.stringField.value;
var clr = "";
var sze = "";
if (document.form1.bigBox.checked) txt = txt.big();
if (document.form1.blinkBox.checked) txt = txt.blink();
if (document.form1.boldBox.checked) txt = txt.bold();
if (document.form1.fixedBox.checked) txt = txt.fixed();
if (document.form1.italicsBox.checked) txt = txt.italics();
if (document.form1.smallBox.checked) txt = txt.small();
if (document.form1.strikeBox.checked) txt = txt.strike();
if (document.form1.subBox.checked) txt = txt.sub();
if (document.form1.supBox.checked) txt = txt.sup();
clr = document.form1.colorList.options[document.form1.colorList.options.selectedIndex].text;
txt = txt.fontcolor(clr);
sze = document.form1.sizeList.options[document.form1.sizeList.options.selectedIndex].text;
txt = txt.fontsize(sze);
objWindow = window.open("", "","width=600,height=300");
objWindow.document.write(txt);
objWindow.document.close();
}
//-->
</script>
</head>
<body>
<h1>
String Object Formatting
</h1>
<hr>
<form method="POST" name="form1">
<p>
<strong>
String:
</strong>
<input type=text size=40 maxlength=256 name="stringField">
</p>
<p>
<strong>
Style:
</strong>
<input type=checkbox name="bigBox" value="ON">
Big
<input type=checkbox name="blinkBox" value="ON">
Blink
<input type=checkbox name="boldBox" value="ON">
Bold
<input type=checkbox name="fixedBox" value="ON">
Fixed
<input type=checkbox name="italicsBox" value="ON">
Italics
<input type=checkbox name="smallBox" value="ON">
Small
<input type=checkbox name="strikeBox" value="ON">
Strike
<input type=checkbox name="subBox" value="ON">
Sub
<input type=checkbox name="supBox" value="ON"> Sup
</p>
<p>
<strong>
Font:
</strong>
Color:
<select name="colorList" size=1>
<option selected>black</option>
<option>green</option>
<option>red</option>
<option>yellow</option>
<option>white</option>
</select>
Size:
<select name="sizeList" size=1>
<option selected>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</p>
<input type="button" name="Show" value="Show" onClick="showWindow()">
</form>
</body>
</html>
|