Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 3: Application Controls > Loading a Complete HTML Document

Loading a Complete HTML Document

A variation on the page example is to work with complete HTML documents, rather than fragments. The basic approach is the same, but I can include script and link elements to load JavaScript and CSS files that are specific to the document. This means I can keep my callback definition code and CSS styles separate from the rest of the application. To begin, I create a new folder called pages and another one called itemDetail inside it. I then add a new HTML file called itemDetail.html, which is shown in Listing 3-13.

Listing 3-13. The itemDetail.html File

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="itemDetail.js"></script>
    <link href="itemDetail.css" rel="stylesheet">
</head>
<body>
    <div id="itemEditor">
        <div>
            <label for="item">Item:</label><input id="item">

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial