Calling function in Javascript
Creating a function in javascript is very simple but calling / invoking the function sometime gets tricky when a function don’t have a parameters, and wondering why the function is it not working…....
View ArticleHow to Call more than one function on loading the web page
If you’re using the following method to invoke more than one function then you’re stuck, you will be wasting you time on debugging trying to figure out what’s the problem. function callMe1() { …. }...
View ArticleHow to Load multiple function in javascript
function AddLoadEvent(functionName) { var oldOnload = window.onload; if (typeof window.onload != 'function') { window.onload = functionName; } else { window.onload = function() { oldOnload();...
View ArticleAccess denied in XmlHttpRequest
It’s a security thing to prevent people from using AJAX between websites and servers. Basically, whenever you write a URL in AJAX, it has to be the same URL as the website you are running the script...
View ArticleHow to replace all occurrences in javascript
To replace all occurrences in a string use the “g” modifier without double quote like this var strvar = “one two one”; strvar = strvar.replace(/one/g,”1″); the output of the strvar would be “1 two 1″
View ArticleHow to refresh the page using javascript
3 Ways to refresh/reload the page using javascript <input type=”button” value=”Reload Page” onClick=”window.location.reload()”> <input type=”button” value=”Reload Page”...
View ArticleHow to get Event object of Firefox
function getEvent() { if (window.event) return window.event; else return getEvent.caller.arguments[0]; } function showMessage(){ var e = getEvent(); // you can use this e object }
View Article‘null’ is null or not an object
This error occurs when the object/element you are trying to access does not exists in the html page or you did not specify the ID of the element. or You are executing a code while the html page has not...
View ArticleHow to detect if HTML document has fully initialized
Most programmers use the “onload” event to detect if the document has fully loaded, but there’s a flaws relying on this technique. The alternative of detecting is to check the DOM tree of the...
View Article