<?php
//enable visitors to see the PHP source code of current file
$me basename($_SERVER['PHP_SELF']);
if(isset(
$_GET['showPHP'])){
    
show_source("$me");    
    die();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="assets/stylesheet.css" type="text/css" rel="stylesheet"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<?php 
include("includes/header.inc.php");
?>

<!--This meta element defines a description of my page:-->
<meta name="description" content="Background Color Change with JavaScript" /> 

<!--This meta element defines keywords for search engines :-->
<meta name="keywords" content="JavaScript, Background, Color, Change" /> 

<!--This meta element identifies the document for search engines as being intended for EN="English" readers.-->
<meta http-equiv="Content-Language" content="en"/>

<title>Background Color Change with JavaScript</title>
</head>
<body>

<div id="wrapper">
    <div id="center-box">
    
        <div class="menu bubplastic horizontal aqua">
            <ul>
                <li><span class="menu_r">
                <a href="/mobile/index.php" target="_self">
                    <span class="menu_ar">Mobile</span>
                </a></span></li>
                
                <li><span class="menu_r">
                <a href="?showPHP" target="_self">
                    <span class="menu_ar">Source code</span>
                </a></span></li>
                
                <li><span class="menu_r">
                <a href="sitemap.html" target="_self">
                    <span class="menu_ar">Site map</span>
                </a></span></li>
                
                <li><span class="menu_r">
                <a href="background_color_change-dk.php" target="_self">
                    <span class="menu_ar"><img src="image/dk-icon.png" alt="Dansk flag"/> Dansk</span>
                </a></span></li>
        
                <li><span class="menu_r">
                <a href="background_color_change.php" target="_self">
                    <span class="menu_ar"><img src="image/eng-icon.png" alt="English flag"/> English</span>
                </a></span></li>
            </ul>
          <br class="clearit" />
        </div>

<?php 
include("includes/header_img.inc.php");
?>
        <div id="left-right-padding">
<?php 
include("includes/navigation.inc.php");
?>
            <br/>
            <h1>JavaScript</h1>
            
            <p>JavaScript is a object-oriented, scripting language, 
            dialect of the standardized programming language ECMAScript, 
            mainly used for scripting web-pages. </p>
            <p>Javascript was originally named &quot;Live Script&quot; 
            by Netscape and supported only by the Netscape browser.</p>

            <p>JavaScript uses syntax influenced from that of the C family of languages.
            JavaScript follows many names and naming conventions from the Java 
            programming language, but the two languages are otherwise not 
            related and have very different semantics.</p> 
            <br/>
            <div class="hr"></div>
            <br/>
            
            <h2>Background Color Change with JavaScript</h2>
            
            <script language="JavaScript">
            <!--
            function changeBGC(color){
            document.bgColor = color;
            }
            //-->
              </script>
            
            <a href="#" onClick="javascript:changeBGC('#000099')">Click Blue</a>
            <div style="clear: left;"></div>
            
            <a href="#" onClick="javascript:changeBGC('#990000')">Click Red</a>
            <div style="clear: left;"></div>
            
            <a href="#" onClick="javascript:changeBGC('#009900')">Click Green</a>
            <div style="clear: left;"></div>
            
            <a href="#" onClick="javascript:changeBGC('#000000')">Click Black</a>
            <div style="clear: left;"></div>
            
            <a href="#" onClick="javascript:changeBGC('#ffffff')">Click White</a>
            
            
            <p>&nbsp;</p>
            <h3>This is the JavaScript code that is used to change colors:</h3>
            <div class="code-text-display"> 
                <p>&lt;script language=&quot;JavaScript&quot;&gt;<br />
                &lt;!--<br />
                function changeBGC(color){<br />
                document.bgColor = color;<br />
                }<br />
                //--&gt;<br />
                &lt;/script&gt;<br />
                <br />
                &lt;a href=&quot;#&quot; onClick=&quot;javascript:changeBGC
                ('#000099')&quot;&gt;Click Blue&lt;/a&gt;<br />
                
                <br />
                &lt;a href=&quot;#&quot; onClick=&quot;javascript:changeBGC
                ('#990000')&quot;&gt;Click Red&lt;/a&gt;<br />
                
                <br />
                &lt;a href=&quot;#&quot; onClick=&quot;javascript:changeBGC
                ('#009900')&quot;&gt;Click Green&lt;/a&gt;<br />
                
                <br />
                &lt;a href=&quot;#&quot; onClick=&quot;javascript:changeBGC
                ('#000000')&quot;&gt;Click Black&lt;/a&gt;<br />
                
                <br />
                &lt;a href=&quot;#&quot; onClick=&quot;javascript:changeBGC
                ('#ffffff')&quot;&gt;Click White&lt;/a&gt;</p>
          </div>
                        
            <h5>Who on earth would NOT have Javascript running in their browser?  Well..</h5> 

            <p>There are legitimate reasons to switch it off</p> 
            <ul>
                <li>Some companies strip JavaScript at the Firewall</li>
                <li>Some people run the NoScript Firefox extension to protect themselves from common XSS vulnerabilities</li>
                <li>Some mobile devices ignore JS entirely</li>
            </ul>
            

      </div>
         <br/>
         <br/>
<?php 
include("includes/footer.inc.php");
?>
  
    </div>
</div>
</body>
</html>