Simon Willison’s Weblog

Subscribe
Atom feed for javascript

706 posts tagged “javascript”

2004

The Register hit by XSS

Here’s a nasty one: popular tech news site The Register was hit on Saturday by the Bofra exploit, a nasty worm which uses an iframe vulnerability in (you guessed it) Internet Explorer to install nasty things on the victim’s PC. Where it gets interesting is that the attack wasn’t against the Register themselves; it came through their third party ad serving company, Falk AG.

[... 262 words]

Executing JavaScript on page load

Peter-Paul Koch recently wrote:

[... 772 words]

2003

Javascript from Python

In a way I’m disappointed to see python-spidermonkey released. It’s a Python wrapper around the Mozilla project’s SpiderMonkey Javascript engine which allows Python scripts to execute Javascript code in a rock-solid, battle-tested embedded interpreter.

[... 187 words]

Silly JavaScript Security. “Sorry, you do not have permission to press this key,”

# 5th December 2003, 10:42 pm / security, javascript

The good and the ugly

PHP.net has a new feature on their search page—a really nice implementation of an auto complete text widget in Javascript. Even better, the search page is valid XHTML 1.0 Strict and uses CSS for the layout. Let’s hope this is an indication of things to the come for the rest of the site, which still mostly consists of tag soup.

[... 368 words]

getElementsBySelector()

Inspired by Andy, I decided to have a crack at something I’ve been thinking about trying for a long time. document.getElementsBySelector is a javascript function which takes a standard CSS style selector and returns an array of elements objects from the document that match that selector. For example:

[... 172 words]

Image Drag bookmarklet

I got a good response to yesterday’s call for help on finding an HTML element’s co-ordinates on a page. I ended up using PPK’s findPos functions which seemed to do the trick just fine.

[... 338 words]

Better image rollovers

When browsing through other site’s source code, some of the ugliest HTML occurs when the site uses one of the most basic javascript effects: The image rollover. There are a myriad of these scripts available for free on the web, but as far as I can tell every single one of them requires event handling code to be added to the markup of the page.

[... 341 words]

2002

Blockquote citations

Inspired by Adrian Holovaty, I spent an hour this morning getting dirty with the DOM in an effort to replicate his funky CSS blockquote citations effect but with links that you can actually click on. The resulting code is now active on this weblog—check the javascript out here.

[... 86 words]

Optimising Javascript

A thread on SitePoint lead me to these two excellent tutorials: Javascript Optimisation and Tackling JavaScript strict warnings.

Blogchat rocks

I spent a while today over at Brent Ashley’s blog chatting away on BlogChat. BlogChat is Brent’s impressive DHTML chat system (backend in PHP, front end via JSRS) which allows anyone visiting his blog to talk to him (and other visitors) in real time, provided he is online to host the session. During the afternoon I got to talk to people from all over the world, all with similar interests because they all had the same taste in blogs. I am hoping to install a version of Brent’s system on this site in the not-too-distant future.

How Wolfenstein 5k works

I linked to the 5k entry Wolfenstein 5K the other day. Lee Semel, the author of the entry, has written an article describing how the impressive Javascript first person shooter works. The principle method used is the dynamic creation of XBM images using a 3D graphics technique known as raycasting (described in this tutorial). The author incorrectly states that Mozilla does not have the capacity to render XBMs—Wolfenstein 5K runs just fine in my version of Mozilla so I presume support has been added since he last tested it.

The 5k

The 5k is an annual competition in which entrants must create the most impressive web site in 5k or less. This year’s competition entries are now online and the quality of the entries is even higher than the previous two years. My initial favourite is Wolfenstein 5K, a texture mapped first person shooter implemented in 5119 bytes of cross browser javascript (I tested it in Mozilla and IE6, and the author claims it runs in Netscape 4).

Javascript select boxes

Via thelist: Javascript Selectbox Functions. Extremely useful demonstrations of how multi-line selectboxes can be used to create advanced user interface widgets with javascript, including tools to alter the order of items in a list and pass values from one selectbox to another and back again.

JSRS 2.1 released

Brent Ashley: JSRS2.1 Released (from June 10th—Internet Archive copy). JSRS is Javascript Remote Scripting, an incredibly powerful javascript library that allows DHTML pages to communicate with a web server without having to reload the page. This latest version fixes POST suport for Mozilla. The library opens the way for a whole host of interactive web applications without the normal limitations caused by the request-and-response nature of the web. Best of all, JSRS is cross platform (at least for Mozilla, NS4+ and IE4+).

[... 151 words]

Tree from unordered list

The amazing tree generator (via webgraphics, who in turn got it from CSS Discuss). This is just the kind of DHTML I really like. Place a simple nested unordered list in your document and this external javascript can use the DOM to convert the list in to a hierarchical outline style tree, with each node expandable to show the child members. It looks great and works in both IE and Mozilla—I haven’t tested it in other browsers but it should degrade gracefully, leaving them with a static nested list.