p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Beginning JavaScript 4th Edition (http://p2p.wrox.com/book-beginning-javascript-4th-edition-529/)
-   -   Chapter 1 Example 1- not working in browser (http://p2p.wrox.com/book-beginning-javascript-4th-edition/94264-chapter-1-example-1-not-working-browser.html)

WednesdayAddams March 15th, 2015 01:13 PM

Chapter 1 Example 1- not working in browser
 
Hi everyone, I am having a problem with my browsers.

When I open the file (in both Chrome and Firefox) from the very first example in the book, all I see is a solid black page. I feel like an idiot missing something quite obvious here...[:confused:]
I have triple checked the code:

<html>
<body bgcolor=”WHITE”>
<p>Paragraph 1</p>
<script type=”text/javascript”>
document.bgColor = “RED”;
</script>
</body>
</html>


This is the error message I see when I open Web Developer in Firefox:
"The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol."


How can something so simple be going so wrong? What am I missing, how can I fix this problem?
All help is much appreciated.

zmantx June 22nd, 2015 03:21 PM

Hello,

Try adding the tag <!doctype html> at the very beginning, before the html tag. Sometimes browsers won't render properly without this declaration.

ananan March 29th, 2016 08:46 AM

In my case, the problem was with brackets. Just make sure to use " " or ' ', and not ” ”.


All times are GMT -4. The time now is 03:41 AM.

Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.