CS 175/286 - Lecture 9

Cover page image

Cay S. Horstmann

HTML 5 + JavaScript

A Template HTML 5 Document with jQuery Mobile

<!DOCTYPE html>
<html> 
 <head> 
    <title>Hello HTML 5</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"/> 
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />			
		<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
		<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head> 
<body> 

<div data-role="page">

    <div data-role="header">
        <h1>My First HTML Application</h1>
    </div>

    <div data-role="content">    
        <p>This is an HTML 5 app.</p>        
    </div>

</div>

</body>
</html>

Hello HTML 5 app.

General formal of a document

Where to Find Examples

Starting Out With jQuery Mobile

Fixing the Targets

  • We need to work on the link targets. Right now, they go back to the same page. Set up three pages
    <div data-role="page" id="question">
        <div id="questionText" data-role="header">
        </div>   
         <div data-role="content">
            <ul id="choices" data-role="listview">
            </ul>
        </div>
    </div>
    <div data-role="page" id="correct">				
       congratulations goes here
    </div>
    <div data-role="page" id="incorrect">				
       message goes here
    </div>					
    
    Change the link targets from # to #correct or #incorrect. Now what does your app do?
  • In the Emulator