Monday, September 10, 2012

Font Manipulation Sample in Javascript


Font Manipulation Sample


<HTML>
<HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT">
function processingForm()
{
var  my_font="", my_size="", my_str="";
var index1 = document.form1.Menu1.selectedIndex;
var index2 = document.form1.Menu2.selectedIndex;

my_str=document.form1.f_text.value;
my_size=document.form1.Menu1.options[index1].value;
my_font=document.form1.Menu2.options[index2].value;
document.write("<P>"+"<FONT  SIZE=' "  +my_size + " 'FACE=' "+   my_font +" '>" +my_str  +"</FONT></P>")
}
</SCRIPT>
</HEAD>
<BODY>

<FORM NAME = "form1">
<H1  ALIGN = "CENTER"><I> SIMPLE FORM PROCESSING  </I></H1>
<BR>
<P>Text<BR><INPUT TYPE ="TEXT"   NAME="f_text"  SIZE = "20" MAXLENGTH = "20"></P>
<P>  Choose font size
<BR>
<SELECT NAME = "Menu1">
<option value="1">8
<option value="2">10
<option value="3">12
<option value="4">14
<option value="5">16
<option value="6">18
</SELECT></P>
<P> Choose font face
<BR>
<SELECT NAME ="Menu2">
<OPTION VALUE="Garmond"> Garmond
<OPTION VALUE="Courier">Courier
<OPTION VALUE="Arial black">Arial black
<OPTION VALUE="Impact">Impact
</SELECT></P>
<P   ALIGN="CENTER"><INPUT TYPE="BUTTON"   VALUE="Submit Form"
ONCLICK="processingForm()">
</FORM>
</BODY>
</HTML>
















0 comments:

Post a Comment