I’m frustrated

Unable to run the "Hello World" example from "Learning JavaScript"

Hello, I am unable to run the first example of "Hello World" in a browser. This is what I typed in a notepad:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml...>

Hello, World!


I selected "Open File" in Mozilla but I did not see the alert. Instead, the browser displayed the code that I wrote...........if that makes sense.
1 person has
this question
  • Hi Kenneth,

    I'm sorry for the frustration, but thanks for writing us. It sounds like your file was saved as a .txt file instead of a .html file.

    To save the file as .html, go to File > Save As > enter your desired File name, like myfile.html, and then change the Save as type dropdown that says Text Document to say All Files. This should allow you to save a file with a .html extension, which you should then be able to open in the browser and see the interpreted page instead of text.

    I hope this helps! Let us know if you have more questions.

    Rachel James
    O'Reilly Media
  • (some HTML allowed)
    How does this make you feel?
    Add Image

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned