JavaScript
You are currently browsing the articles from KomKid.Net matching the category JavaScript.
1 2
| fullURL = parent.document.URL
GetVar = fullURL.substring(fullURL.indexOf('?')+xxx, fullURL.length) |
? = variable name
xxx = length of GET variable name.
Example.
1 2
| fullURL = parent.document.URL
GetVar = fullURL.substring(fullURL.indexOf('topicid')+7, fullURL.length) |
Written by Komkid on August 5th, 2009 with no comments.
Read more articles on JavaScript and Programming.
1 2 3 4 5
| var today = new Date();
ThisYear = today.getYear()+0;
if(ThisYear <= 1999){
ThisYear = ThisYear - 100 + 2000;
} |
Written by Komkid on August 5th, 2009 with no comments.
Read more articles on JavaScript and Programming.
Don’t :
1
| if (form.input.value == "") |
Do :
1
| if (form.input.value.length == 0) |
or
1
| if (form.input.value.replace(/\s+$/, "") == "") |
Written by Komkid on August 5th, 2009 with no comments.
Read more articles on JavaScript and Programming.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| /* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Lee Underwood | http://javascript.internet.com/ */
function getFocus() {
// place the id below of the field you want to have focus upon page load
var focusHere = document.getElementById("yourName");
focusHere = focusHere.focus();
}
// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
getFocus();
}); |
Written by Komkid on August 5th, 2009 with no comments.
Read more articles on JavaScript and Programming.
No older articles
Newer articles »