Difference between revisions of "Javascript"

From Wikicliki
Jump to: navigation, search
 
Line 3: Line 3:
 
== Fullscreen ==
 
== Fullscreen ==
  
i found that the [NHS flu site  
+
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.
+
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>
  
== Array ==
+
== Blur/Focus ==
 +
 
 +
Focus: puts the cursor in that box to begin with.
 +
 
  
ARGHAGHGHHGHHHHHHHHHHHHHHHHHHHHHH
+
== Simple HTTP Server ==
  
== Blur/Focus ==
+
In Mac OS X you can run the following 2 commands:
 +
> cd /path/to/project/folder
 +
> python -m SimpleHTTPServer 8080
  
Focus: puts the cursor in that box to begin with.
+
go to http://localhost:8080 to see the site
 +
you can change the port to another number
  
 
== See Also ==
 
== See Also ==

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

See Also