12.07.2015 Views

Answers to practice questions for the final exam. 1. Write a CSS style ...

Answers to practice questions for the final exam. 1. Write a CSS style ...

Answers to practice questions for the final exam. 1. Write a CSS style ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

a). Immediately when <strong>the</strong> page appears.b). If <strong>the</strong> page is not completely loaded <strong>for</strong> some reason.c). If ano<strong>the</strong>r window is opened on <strong>to</strong>p of <strong>the</strong> current one.d). If <strong>the</strong> user clicks on <strong>the</strong> link.A linke). If <strong>the</strong> user double-clicks on <strong>the</strong> link.A linkf). If <strong>the</strong> user moves <strong>the</strong> mouse over <strong>the</strong> link, and <strong>the</strong>n away.A link5. Below are pairs of JavaScript commands. For each pair, (i) determine whe<strong>the</strong>r a functionshould be used <strong>to</strong> carry out <strong>the</strong> work of both lines, and (ii) if so, give <strong>the</strong> function definition andset of calls <strong>to</strong> it that would replace <strong>the</strong> original pair or commands. An <strong>exam</strong>ple has been done <strong>for</strong>you.a). document.writeln(“My favorite color is blue.”)document.writeln(“My favorite color is red.”)Ans: function tellColor(clr) {// prints a message about my favorite color.document.writeln(“My favorite color is “+clr+”.”)}tellColor(“blue”)tellColor(“red”)b).<strong>to</strong>tal += price1+0.05*price1<strong>to</strong>tal += price2+0.05*price2Ans: function addTax(price) {// adds tax on<strong>to</strong> <strong>the</strong> price.return price+0.05*price}<strong>to</strong>tal += addTax(price1)<strong>to</strong>tal += addTax(price2)

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

Saved successfully!

Ooh no, something went wrong!