View Single Post
  #6 (permalink)  
Old January 17th, 2011, 03:54 PM
Toi B Wright Toi B Wright is offline
Authorized User
Points: 66, Level: 1
Points: 66, Level: 1 Points: 66, Level: 1 Points: 66, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2010
Location: Dallas, TX
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default Chapter 1 for FireFox

This is the corrected code that will work on all of the non-Microsoft browsers:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Hello World</title>
    <style type="text/css">
        h1
        {
            color: Blue;
        }
    </style>
    <script type="text/javascript">
        function ShowSelection() {
            alert('You have selected ' + document.getElementById("SelectColor").value);
            document.getElementById("BodyContent").style.backgroundColor = document.getElementById("SelectColor").value;
        }
    </script>
</head>
<body>
    <div id="BodyContent">
        <h1>
            Hello World</h1>
        <h2>
            Welcome</h2>
        This is my first web page.
        <hr />
        Please select a color:
        <select id="SelectColor">
            <option value="white">white</option>
            <option value="silver">silver</option>
            <option value="yellow">yellow</option>
        </select>
        <input id="ButtonSelect" type="button" value="Select" onclick="ShowSelection();" />
    </div>
</body>
</html>