
No quiz today

<del> in Markdown)<!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.0/jquery.mobile-1.3.0.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>My First HTML App!</h1>
</div>
<div data-role="content">
<p>This is an HTML 5 app.</p>
</div>
</div>
</body>
</html>
<!DOCTYPE html>, this is for legacy reasons due to how browsers detect whether they need to go into quirks mode. The line tells a browser -- mobile or otherwise -- that what follows should be a validating document. The fact that we don't declare the version of HTML in this tag is the browser's clue that it is HTML 5.name="viewport" is an attribute of the meta tag on the last slide.
span {
background-color:red;
font-size:20pt;
}
<a href="http://www.link-to-somewhere.com/">Link Text</a>
<ul data-role="listview" data-inset="true" data-filter="true">
<li><a href="#">Red</a></li>
<li><a href="#">Green</a></li>
<li><a href="#">Blue</a></li>
<li><a href="#">Violet</a></li>
<li><a href="#">Ultra-Violet</a></li>
</ul>
<script type="text/javascript"> code </script>
<script type="text/javascript" src="myscript.js" />
return x; // has the effect of just return!
x = 5.5; y = x.toString();
document.write("Hi there!");
document.writeln("This strings has a new line after it!");
<a href="javascript:alert('hi there')">Hi there alert</a>
Hi there alert
<button onclick="alert('hi there')">Hi There!</button>
<button id="yo">Yo!</button>
<script>
document.getElementById("yo").onclick = function() {alert("yo");}
</script>
var my_object = new Object();
my_object.make= "V6" /* would then give a property make a value. */ //can access as p = my_object["make"] q = my_object.make
my_object.subObject = new Object();
for (var prop in my_object){...}
var myArr = new Array(1, 2, "hello") var myArr = new Array(100); var myArr = [1,2,3]; //to access myArr[0] //to determine length myArr.length
Below is an example of the syntax for declaring a function in Javascript
function swap(i, j, a)
{
var tmp=a[i]; /* explicitly defined variables
have scope within the function
if I had declared the variable
implicitly it would have global scope */
a[i] = a[j]; a[j] = tmp;
}
swap(10, 5, b);
var b = swap;
swap = function(i, j, a) { /* code above */}
function swap()
{ var i = this.arguments[0], j=this.arguments[1], a=this.arguments[2];
//same code as before
}
function car(new_make, new_model, new_year)
{
this.make = new_make;
this.model = new_model;
this.year = new_year;
}
my_car = new car("Ford", "Contour SVT", "2000");
function display_car()
{
document.write("Make:", this.make, "<br />");
document.write("Model:", this.model, "<br />");
document.write("Year:", this.year, "<br />");
}
function car(/*same as before*/)
{ //same as before
this.display = display_car;}
function car(/*same as before*/)
{ //same as before}
car.prototype.display = display_car;
document.getElementById("yo").onclick = function() {alert("yo");}
in jQuery we could do: $("#yo").onclick = function() {alert("yo");}
$(document).ready(handler) // or $(handler)


public_html in the base directory of your repo (in parallel to the workspace directory). Inside, place a file lab09.html. Put in the JQuery Mobile outline from the lecture slide. Load it in your browser. What happens?http://cs10.cs.sjsu.edu/lastname_firstname/lab09.html. You should see the same contents. If not, wait a minute or so. public_html directory gets copied to the cs10 server every couple of minutes so that you can test your code on a mobile device.<a href="#">Android</a>Try that. How does the item appearance change?
<div data-role="page" id="question"> question goes here </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?
href attributes from the links and add the following into the head part of your page:
<script type="text/javascript">
$(document).ready(function() {
// do stuff when DOM is ready
$('a').click(function(event) { alert(event.target.firstChild.textContent) })
});
</script>
Now what happens when you click a link?