R
Randy Webb
VK said the following on 10/24/2005 10:39 AM:
And you also need to know it's problems and limitations.
It means all that plus "and give a non-JS browser a useless blank page".
It means all that plus "and give a non-JS browser a useless blank page".
<a href="noJS.html" onclick="alert('This doesnt break without JS, you
just dont see the alert')">Test Me</a>
Why make it more difficult than it has to be?
Who said that?!? Not me.
javascript: p-protocol is a great thing. You just need to know how it
works and enjoy ever after.
And you also need to know it's problems and limitations.
1) javascript:someFunction() means: "execute someFunction and replace
current page by content from someFunction's return value". Thusly if
someFunction returns null, you'll end up with a blank page with the
proud word "null" written in the top left corner.
It means all that plus "and give a non-JS browser a useless blank page".
2) javascript:void(someFunction()) means: "where will be no new content
provided, just stay where you are; and by the way execute
someFunction".
It means all that plus "and give a non-JS browser a useless blank page".
Despite what some people says, void() operand *doesn't return* neither
null, nor undefined. As its name suggests it does not return any values
whatsoever. This is how it works in Java also (there this idea has been
taken from).
Yes if you try to assign
var foo = void(something);
then you'll get undefined. But it's the same "pseudo-value" as in case:
var arr = new Array(1,2,3);
var foo = arr[1000]; // the same undefined as with void()
<a href="noJS.html" onclick="alert('This doesnt break without JS, you
just dont see the alert')">Test Me</a>
Why make it more difficult than it has to be?