zpavlinovic
zpavlinovic

Reputation: 1547

Defining (embedding) Javascript

I would like to collect all possible ways with which JavaScript can be defined in the web page for execution.

So far I know the basic part:

Thanks!

Upvotes: 2

Views: 143

Answers (3)

amosrivera
amosrivera

Reputation: 26514

I think the only one left is in the href attribute of anchors links like:

<a href="javascript:alert('hello, world!');">Say Hello</a>

This is how bookmarklets work.

This document describes all ways of embedding: http://docstore.mik.ua/orelly/webprog/jscript/ch12_02.htm

Upvotes: 1

katspaugh
katspaugh

Reputation: 17899

More fugly things:

CSS expressions in IE — allows defining CSS properties as JavaScript expressions, which are evaluated on every possible DOM-event (on every mouse move, scroll step and so on).

DHTML Behaviors in IE — can bind .htc-files with JScript to HTML elements through CSS.

XBL bindings, Mozilla's invention, can be defined via CSS as well.

Upvotes: 1

jfriend00
jfriend00

Reputation: 707436

In links, <a href="javascript:alert('Hi')">

Upvotes: 2

Related Questions