13.02.2013 Views

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Sliding in the code<br />

In the proof-of-concept example, I placed all the functions in one single .js file. This included the addEvent function. If you<br />

are likely to use the addEvent function for more than one purpose across the site, it’s probably better to split the .js file<br />

into two:<br />

A file containing the addEvent function (which can be used anywhere on the site for whatever purpose)<br />

Another file containing the print-handling functions (as it needs to be called only on pages that get this printing<br />

treatment)<br />

So that’s what I did for the practical application (the interest rates page in question can be found at www.nationwide.<br />

co.uk/savings/rates.htm (but please don’t study the rest of the markup too closely, you might upset yourself—I don’t<br />

have total control over what goes live, honest!). Here are the links to the JavaScript in the head of the document:<br />

<br />

<br />

<br />

<br />

That’s the behavior added in. Now what’s needed is to add in the extra markup around the relevant sections on the page as<br />

it currently stands. Here’s an example using one of the smallest sections (just two table rows) with the new markup that we<br />

need for the print functions to work:<br />

<br />

<br />

<br />

<br />

accounts for over 65s<br />

interest tier<br />

AER %<br />

AER* %<br />

gross p.a. %<br />

net p.a. %<br />

&nbsp;<br />

<br />

<br />

<br />

<br />

<br />

<br />

Monthly Income 65+passbook account<br />

with a guaranteed regular income for the over 65's<br />

effective from:&nbsp;01/09/2005<br />

<br />

1+<br />

4.50<br />

n/a<br />

4.41<br />

3.53<br />

<br />

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

Saved successfully!

Ooh no, something went wrong!