CS174
Chris Pollett
Apr 4, 2016
We now want to consider adding dynamic behaviors to our websites as they are interacted with on the client-side. To do this, we will use the Javascript language.
<script type="text/javascript"> -- code -- </script>
<script type="text/javascript" src="myscript.js" />
Which of the following statements is true?
git checkout url_of_repository
return x; // has the effect of just return!
<html>
<head><title>test</title>
<meta name="description" value="this example illustrates how Javascripts are executed both when the document is loaded and on the occurrence of events" />
<script type="text/javascript" >
function sayHello()
{
alert("hi there");
}
</script>
</head><body><form><input type="button" value="test" onclick="return sayHello();"
/><!-- responds to events --></form>
<script type="text/javascript" >
for( i = 0; i<100; i++) {
document.writeln("<p>hi"+i+"</p>");
} // run when document loads
</script></body>
</html>
var my_variable, pi=3.14; // explicit declarations effect the scope of the variable
first = "hello" second = first + "bye" // "hellobye"
"August" + 1977 // "August1977" 1977 + "August" // "1977August" 7*"3" =21
var str_value = String(value); // Might want to use toString var some_number = Number(some_string); // Might want to use parseInt or parseFloat