|
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]
|