DelphiFAQ Home Search:
General :: Web publishing :: JavaScript
Code snippets to add functionality to your HTML pages, preferably cross-browser.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Introducing namespaces into Javascript


How to avoid variable overlap problems (stepping on the fellow engineers' toes)


Use namespaces as shown below. Make all functions members of an object - here named pt_scope - that is instantiated exactly one time. Then call functions as members of this global object.

<script language=javascript>
 function go() {
 var pt_scope = {
 	a: function() {alert('hello'); },
 	b: function() {document.write('junk'); }
 <a href=javascript:go()>GO</a>

Generated 20:01:41 on Apr 2, 2020