Controlling FONT Object Properties : Font « HTML « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Event
7. Event onMethod
8. Form Control
9. GUI Components
10. HTML
11. Javascript Collections
12. Javascript Objects
13. Language Basics
14. Node Operation
15. Object Oriented
16. Page Components
17. Security
18. Style Layout
19. Table
20. Utilities
21. Window Browser
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
JavaScript DHTML » HTML » Font 
Controlling FONT Object Properties


/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

Publisher: John Wiley & Sons CopyRight 2001
ISBN: 0764533428
*/

<HTML>
<HEAD>
<TITLE>FONT Object Properties</TITLE>
<SCRIPT LANGUAGE="JavaScript">
// document.all normalization trick for NN6
if (navigator.appName == "Netscape" && parseInt(navigator.appVersion>= 5) { 
   document.all = document.getElementsByTagName("*"
}
// one function does all!
function setFontAttr(select) {
    if (document.all && document.all.myFONT) {
        var choice = select.options[select.selectedIndex].value
        if (choice) {
            document.all.myFONT.setAttribute(select.name, choice)
        }
    }
}
</SCRIPT>
</HEAD>
<BODY>
<H1>Font Object Properties</H1>
<BR>
<P>This may look like a simple sentence, but 
<FONT ID="myFONT">THESE THREE WORDS</FONT> 
are contained by a FONT element.</P>
<FORM>
Select a text color: 
<SELECT NAME="color" onChange="setFontAttr(this)">
    <OPTION></OPTION>
    <OPTION VALUE="red">Red</OPTION>
    <OPTION VALUE="green">Green</OPTION>
    <OPTION VALUE="blue">Blue</OPTION>
    <OPTION VALUE="#FA8072">Some Hex Triplet Value</OPTION>
</SELECT>
<BR>
Select a font face: 
<SELECT NAME="face" onChange="setFontAttr(this)">
    <OPTION></OPTION>
    <OPTION VALUE="Helvetica">Helvetica</OPTION>
    <OPTION VALUE="Times">Times</OPTION>
    <OPTION VALUE="Comic Sans MS, sans-serif">Comic Sans MS, sans-serif</OPTION>
    <OPTION VALUE="Courier, monospace">Courier, monospace</OPTION>
    <OPTION VALUE="Zapf Dingbats, serif">Zapf Dingbats, serif</OPTION>
</SELECT>
<BR>
Select a font size: 
<SELECT NAME="size" onChange="setFontAttr(this)">
    <OPTION></OPTION>
    <OPTION VALUE="3">(Default)</OPTION>
    <OPTION VALUE="+1">Increase Default by 1</OPTION>
    <OPTION VALUE="-1">Decrease Default by 1</OPTION>
    <OPTION VALUE="1">Smallest</OPTION>
    <OPTION VALUE="7">Biggest</OPTION>
</SELECT>
</BODY>
</HTML>


           
       
Related examples in the same category
1. Font array and date
2. Change font size
w__ww._j__a__v___a__2_s_._c_o_m__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.