Difference between revisions of "Javascript"
From Wikicliki
(→See Also) |
|||
| Line 1: | Line 1: | ||
| − | + | What is going on. | |
| + | |||
| + | == Fullscreen == | ||
| + | |||
| + | i found that the [NHS flu site | ||
| + | http://www.immunisation.nhs.uk/Vaccines/Flu] resized itself to the fullest biggest width of the browser window. irregardless of how big it was. very accessible naturally. | ||
| + | |||
| + | /js/size.js : | ||
| + | <pre> | ||
| + | var pixelsPerEm; | ||
| + | window.onresize = rze; | ||
| + | |||
| + | function lde() { | ||
| + | pixelsPerEm = document.getElementById('sizer').offsetWidth; | ||
| + | var date = new Date(); | ||
| + | date.setTime(date.getTime()+(60*60*1000)); | ||
| + | document.cookie = 'pixelsperem='+pixelsPerEm+'; path=/'; | ||
| + | rze(); | ||
| + | |||
| + | } | ||
| + | |||
| + | function rze() { | ||
| + | document.body.style.fontSize = (100/((48.5*pixelsPerEm)/document.body.offsetWidth))+"%"; | ||
| + | var date = new Date(); | ||
| + | date.setTime(date.getTime()+(60*60*1000)); | ||
| + | document.cookie = 'textsize='+document.body.style.fontSize+'; path=/'; | ||
| + | } | ||
| + | </pre> | ||
| + | |||
== document.write == | == document.write == | ||
Revision as of 11:31, 28 November 2008
What is going on.
Fullscreen
i found that the [NHS flu site http://www.immunisation.nhs.uk/Vaccines/Flu] resized itself to the fullest biggest width of the browser window. irregardless of how big it was. very accessible naturally.
/js/size.js :
var pixelsPerEm;
window.onresize = rze;
function lde() {
pixelsPerEm = document.getElementById('sizer').offsetWidth;
var date = new Date();
date.setTime(date.getTime()+(60*60*1000));
document.cookie = 'pixelsperem='+pixelsPerEm+'; path=/';
rze();
}
function rze() {
document.body.style.fontSize = (100/((48.5*pixelsPerEm)/document.body.offsetWidth))+"%";
var date = new Date();
date.setTime(date.getTime()+(60*60*1000));
document.cookie = 'textsize='+document.body.style.fontSize+'; path=/';
}
document.write
document.write("Hello") // - prints Hello
var text="Hello"
document.write(''+text+'') // - prints Hello
var text="Hello"
document.write(''+text+'') // - prints Hello
Array
ARGHAGHGHHGHHHHHHHHHHHHHHHHHHHHHH
Blur/Focus
Focus: puts the cursor in that box to begin with.