Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Wrong Color

  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Wrong Color

    I am using an external style sheet to set the color of my calculator to gray. However, when I open my javascript in Google Chrome, the calculator is red. I've checked the style sheet code and it's correct. Can anyone tell me why this is happening? I posted both the html and css code below.

    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>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Calculator</title>
    <link rel="stylesheet" type="text/css" href="assignment2.css" />	
    <div align="center">
    <script type="text/javascript">
    var title = "<strong>Calculator</br> Aughtman, Zackary</strong>"
    document.write(title.fontsize(5));
    </script>
    </div>
    </head>
    
    <body>
    </br>
    </br>
    <div align="center">
    <table align = "center" border="1" bordercolor="div1" bgcolor="div2">
    		<tr>
    			<td colspan="4">
    			<input type="text" value="" id="results" class="results" />
    			</td>
    		</tr>
    		<tr>
    			<td>
    			<input type="button" style="width:30px" value="7" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="8" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="9" onclick="EnterNumber(this.value)">	
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="/" onclick="EnterOperator(this.value)">
    			</td>
    		</tr>
    		<tr>
    			<td>
    			<input type="button" style="width:30px" value="4" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="5" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="6" onclick="EnterNumber(this.value)">	
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="*" onclick="EnterOperator(this.value)">
    			</td>
    		</tr>
    		<tr>
    			<td>
    			<input type="button" style="width:30px" value="1" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="2" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="3" onclick="EnterNumber(this.value)">	
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="-" onclick="EnterOperator(this.value)">
    			</td>
    		</tr>	
    		<tr>
    		<td>
    			<input type="button" style="width:30px" value="0" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="N" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="L" onclick="EnterNumber(this.value)">	
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="+" onclick="EnterOperator(this.value)">
    			</td>
    			</tr>	
    		<tr>
    		<td>
    			<input type="button" style="width:30px" value="" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="" onclick="EnterNumber(this.value)">
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="=" onclick="EnterNumber(this.value)">	
    			</td>
      			<td>
    			<input type="button" style="width:30px" value="C" onclick="EnterOperator(this.value)">
    			</td>
    		</tr>
    	</table>
    	</br>
    <script type="text/javascript">
    document.write("<strong>Instructions</strong></br>");
    document.write("Click a number, then an action, then another number, then the equals button.</br>");
    document.write("Press C when ready to start over.</br>");
    document.write("The N button makes your previous number a negative.</br>");
    document.write("The L button requires one number to be available,</br>");
    document.write("it will loop through that numberto ten plus that number</br>");
    document.write("and add all values and display.</br>");
    document.write("For example: 1+2+3+4+5+6+7+8+9+10=55</br></br>");
    document.write("<strong>Navigator Info</strong></br>");
    document.write("App Name: Netscape</br>");
    document.write("Cookes Enable: true</br>");
    document.write("User agent Mozilla 5.0 Windows NT 5.1; rv:6.0 Gecko 20100101 Firefox 6.0</br>");
    </script>
    </div>
    </body>
    </html>
    Code:
    #div1 {color:#999999}
    #div2 {color:#999999}

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,917
    Thanks
    56
    Thanked 545 Times in 542 Posts
    give your table an id and reference it properly in your css:

    Code:
    #mytable {border-color:#0000FF;
    background-color:#808080;
    }
    
    <table align = "center" border="1" id="mytable">

  • #3
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Thank you so much! I have the right color!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •