开发者

Defining (embedding) Javascript

开发者 https://www.devze.com 2023-04-08 23:35 出处:网络
I would like to collect all possible ways with which JavaScript can be defined in the web page for execution.

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:

  • script tag
  • external script
  • element attributes that start with "on"
  • inside some tag: WIDTH="&{barWidth};%" ALIGN="LEFT"
  • CSS IE: style="left:expre开发者_开发知识库ssion(document.body.clientWidth/2-oDiv.offsetWidth/2);"
  • DHTML behavior in IE
  • in links: href="javascript:alert('Hi')"

Thanks!


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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号