04.07.2013 Views

Start Here! Learn JavaScript - Cdn.oreilly.com

Start Here! Learn JavaScript - Cdn.oreilly.com

Start Here! Learn JavaScript - Cdn.oreilly.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

tip Make sure you save the file within the project itself, as shown in this dialog. Visual<br />

Studio might attempt to save the file outside of the project. (Note the two “<strong>Start</strong><strong>Here</strong>”<br />

directories in Figure 1-9.)<br />

8. With the file saved, the next step is to view it in a browser. The easiest way to do this in Visual<br />

Studio is to click the Run button on the toolbar or select <strong>Start</strong> Debugging from the Debug<br />

menu. When you do so, Visual Studio performs some background tasks, starts a web server<br />

(Internet Information Services, or IIS), and launches your default web browser. Note that you<br />

might see a dialog indicating that debugging isn’t enabled. Accept the default, and click OK to<br />

modify the web.config to enable debugging.<br />

If all goes well, you eventually see a page like that shown in Figure 1-10.<br />

FIGURE 1-10 A successful run of your first webpage.<br />

If you see a screen like that in Figure 1-10, your project ran successfully. Even though the page<br />

itself is blank, notice that the title bar reads “<strong>Start</strong> <strong>Here</strong>,” thanks to the change you made to<br />

the tag in the page.<br />

9. Close your web browser.<br />

Closing your browser has the effect of stopping the project from running, and you’ll be back<br />

at the source window for your index.html page.<br />

10. Within index.html, add the following code between the opening tag and the closing<br />

tag (saved as index-wjs.html in the <strong>com</strong>panion content):<br />

16 <strong>Start</strong> here! <strong>Learn</strong> <strong>JavaScript</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!