- From: Michael A. Puls II <shadow2531@gmail.com>
- Date: Tue, 22 May 2007 17:10:38 -0400
On 5/22/07, Maciej Stachowiak <mjs at apple.com> 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
Received on Tuesday, 22 May 2007 14:10:38 UTC