You are here: Re: Apostrophe issue « PHP SQL « IT news, forums, messages
Re: Apostrophe issue

Posted by JDS on 09/20/05 16:54

On Tue, 20 Sep 2005 12:39:21 +0200, Hilarion wrote:

>> onMouseOver="switchit('Ginny's Wedding - Jun 11 2005');"

I don't know what the switchit() function is doing, exactly, but does the
apostophe *need* to be there? Meaning, is the switchit() function ever
producing output that may be read by a human?

If not, then why not just strip out all apostrophes and double-quotes
before they get to the JavaScript part -- the JS parser won't care if it
says "Ginny's Wedding" or "Ginnys Wedding" -- as long as the naming is
consistent throuhgout the page.

This is the technique I usually adopt to avoid the type of problem you are
having.

For example, if the switchit() function uses the passed in string as an id
for, say, document.getElementById(), then just make sure the id of the
item also has the apostrophe stripped out. Just an example.

How to strip out? preg_replace() or str_replace() or similar.

later...

--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация