Javascript

DHTML Tips

  • **Instant WYSIWYG editor in IE5+** – Setting the {{contentEditable}} attribute of an element to ‘true’ cause that element to become editable by the user directly in the browser window! e.g.,:
  • Make entire page editable:
<script>document.body.contentEditable = true;</script>
  • Make a single element (e.g., a DIV with the ID ‘myElementID’) editable:
<script>document.getElementById(“myElementID”).contentEditable = true;</script>
This technique is a proprietary Internet Explorer 5+ only extension; Mozilla has a similar extension, but the syntax is different. BJ

Demos

  • Did you know that each HTML page you create actually has two source codes?
    • Original source-code that you wrote
      • The source code that the users web browser has interpreted.
    • This demo shows how to dynamically alter the browser interpreted code using Javascript. This allows you to do some clever things, such as anti-spam email links and content replacement.