~ overflow ~

Javascript Argument Handling

by admin on Oct.31, 2008, under Coding

Problem:

yourhappyhtml.html?argument=xxx

Solution:

function d(){var x=window.location.search.split(‘?’);if(isset(x[1])){setTimeout(“z(“+x[1]+”)”,200);}}

Explanation:

this will call a function z that will show a specific hidden div depending on the parameter sent, due random crappyness on onload function i added a timer as a workaround, to call this in a bare way you should do ?number , and nothing else, x[0] is always null, isset() is:

function isset(v) { return ((v == undefined) || (v == “”)) ? false : true; }

to send more than one argument you will need to split the “=” as well inside the x[1], since javascript will take the whole query as a variable.

:,


No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!