home » portfolio » JAVASCRIPT

 
JavaScript
 

It is true: JavaScript can change the way you live your life. In addition to a speedy load time and multi-platform compatibility, JavaScript creates a more dynamic experience for all users. Following JavaScript links and scripts that I use in this and other sites:

 
Basic JavaScripts
Closes browser window
<a href= “javascript:window.close()”>
Close this window</a>

Send browser back one page
<a href="javascript:history.back(1)”>Go back</a>

Hard reload of current page
<a href ="javascript:location.reload()” target=“_self”>
Reload</a>

Prints current page
<a href=“javascript:window.print()”
Print this page</a>

Detects network settings
<a href=“javascript:doNetDetect()”
title=“Detect Settings” >Dectect network settings</a>

Creates an alert pop-up box
<script language=“JavaScript1.2” >
alert(“Type pop-up message here” );</script>

Loads a new Web page when user closes current viewing page
<script language=“JavaScript1.2” >
<!--
var should_pop=true;
function do_exit_pop() {
if (should_pop) {
win=window.open("http://wwwurl.com/” );
//win2=window.open("http://www.url.com” );
if (!win.opener) { win.opener=self; }
}
// -->
</script>

Writes a line of text
document.writeln (“<b>Text here.</b>” );

Creates a JavaScript prompt
var data = prompt(“Ask for data” ,“Type data here” );

Concatenates, or puts these two together
The “ + ” sign

Use interchangeably
Quotations: ‘ ’ & “ ”

Italisizes text
variable.italics();

Colors text
variable.fontcolor(‘red’);

Makes text uppercase
variable.toUpperCase();
If/then
==, <, >, <=, >=, !=, &&, ||Characters inside quotes are printed; characters not inside quotes are considered variables.

     back to top 

home | travels | music | portfolio | family | search

© 1995 — 2008 Hey Brian? — All Rights Reserved
For questions or comments about this site, contact Brian.