Wednesday, June 23, 2010

Some Java script tricks

  • Edit the content of a web page:
    • By setting contentEditable to true, we can change the content of a web page.
    • Type javascript:document.body.contentEditable='true' in the address bar of your web browser. Not only to body, this can be applied to a wide range of tags.
    • Can check the status of contentEditable by isContentEditable. For example, javascript:document.body.isContentEditable to check the status of body tag.
  • Avoid page refreshing:
    • Typing javascript:void(0) in the address bar avoids page refreshing. void should be used with a number. That is, the parameter of zero is compulsory.
    • Therefore, to alter the content of web pages this has to be added to take the effect of the content to be edited. The whole thing now becomes something put down this way: javascript:document.body.contentEditable='true';void(0).
  • Knowing IP address:
    •  "ip" gives the IP address. For example, "javascript:alert(ip)" would give the IP address of the client.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...