Difference between revisions of "Javascript"
From Wikicliki
| (4 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
== Fullscreen == | == Fullscreen == | ||
| − | + | 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 | + | http://www.immunisation.nhs.uk/Vaccines/Flu] resized itself to the fullest biggest width of the browser window. irregardless of how big it was. |
/js/size.js : | /js/size.js : | ||
| Line 37: | Line 37: | ||
document.write(''+text+'') // - prints Hello</pre> | document.write(''+text+'') // - prints Hello</pre> | ||
| − | == | + | == Blur/Focus == |
| + | |||
| + | Focus: puts the cursor in that box to begin with. | ||
| + | |||
| − | + | == Simple HTTP Server == | |
| − | + | In Mac OS X you can run the following 2 commands: | |
| + | > cd /path/to/project/folder | ||
| + | > python -m SimpleHTTPServer 8080 | ||
| − | + | go to http://localhost:8080 to see the site | |
| + | you can change the port to another number | ||
== See Also == | == See Also == | ||
| Line 52: | Line 58: | ||
*[[Javascript Sandbox]] | *[[Javascript Sandbox]] | ||
*[[Actionscript-Javascript Interaction]] | *[[Actionscript-Javascript Interaction]] | ||
| + | |||
| + | |||
| + | [[Category:Programming]] | ||
Latest revision as of 08:46, 30 December 2015
What is going on.
Fullscreen
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.
/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
Blur/Focus
Focus: puts the cursor in that box to begin with.
Simple HTTP Server
In Mac OS X you can run the following 2 commands: > cd /path/to/project/folder > python -m SimpleHTTPServer 8080
go to http://localhost:8080 to see the site you can change the port to another number