You are here: can't insert javascript call with PHP « PHP Programming Language « IT news, forums, messages
can't insert javascript call with PHP

Posted by rynato on 07/23/07 17:16

Having a devil of a time with something very simple. I have my site
set up so that all tags are written with functions which get the
various attributes for each tag from a mySQL table.

I've included a column for javascript in the table which stores <img>
attributes.

I have an image preload js function which has to be put in one of the
<img> tags because I'm using Google EZMaps and it doesn't like
javascript in the <body> tag, where normally it would go.

Whenever this bit of text is called up from the mySQL table and run
through the <img> writing function, it comes out as:

<img src="foo.jpg" title="foo" (etc etc) onLoad="

that's it. it just chokes after the first quote. It doesn't even close
the tag.

I've tried switching to single quotes. I tried putting backslash
before the quotes. Finally I decided to not call it from the table,
instead just use str_replace to write it in - that is, find " />" (end
of the tag) in the string and replace it with,
"onLoad='preloadImages()' />"

same result - it only replaces it with "onLoad="

can someone please explain WTF is going on here and a workaround?
Thanks in advance!

 

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

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