On 5/22/07, Maciej Stachowiak <[EMAIL PROTECTED]> wrote:
On May 22, 2007, at 12:16 PM, Kristof Zelechovski wrote:
> Forgive my being nosy: which uses?
> a href="javascript:." is valid but it replaces the current document
> with a
> document parsed from the textual representation of the value
> returned from
> the script.
If the javascript: URI returns the undefined value (such as by using
the void operator or by calling a method with no return type), then
the target document is not replaced, but the side effect still occurs.
Yeh, I just do it like this for example:
javascript:(function(){document.body.style.backgroundColor="#f00";})()
Or, properly-encoded as
javascript:(function()%7Bdocument.body.style.backgroundColor%3D%22%23f00%22%3B%7D)()
I use JS URIs all the time in the address field and with bookmarklets.
However, I seldom use them in the page as that can be handled with
events.
--
Michael