[KLUG Members] Opening a popup with Java Script

Michael Lueck mlueck at lueckdatasystems.com
Tue Jun 21 09:29:57 EDT 2005


On Tue, 21 Jun 2005 09:10:06 -0400, Adam Tauno Williams wrote:

>If you escape the single quotes in the
>javascript it doesn't work,  and if you use escaped double quotes it
>doesn't work.

Reminds me of a method I had to come up with in The Nehemiah Project called
HTMLstring2JSstring, any idea what it does?! ;-)

/***************************/
/* Remove HTML tags */
/* Optimizing thanks to MFC */
do forever
   parse var BP BP'<'.'>'AP
   if AP='' then leave
   BP=BP || AP
end /* do */

/* Remove Decimal HTML Numeric Chracter Reference (NCR) */
/* Optimizing thanks to MFC */
do forever
   parse var BP BP'&#'.';'AP
   if AP='' then leave
   BP=BP || AP
end /* do */

/* Remove the quote chars */
BP=BP~changestr('"', '')~changestr("'", '')
/***************************/

Maybe you need something like this in PHP to prep strings before JavaScript
gets to execute them... assuming you have strings shared between HTML and
JavaScript which I have. I call this method to clean up the string before it is
embedded in the JS code... like for the status bar text for mouse over events.
If the special chars are in the string JS gets a little annoyed. ;-)


Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/



More information about the Members mailing list