I need to add a JS script function to my images (custom field), so I tried to use the replace plugin.
Replace this: width=”100”
with this: with=”100” onmouseover=”zxcZoom(this,null,140,null,15,’C’);” onMouseOut=”zxcZoom(this);”
Problem: it breaks up because of the single quote at argument 6 (‘C’) in zxcZoom.
I’ve tried adding single quotes like this:
find=’width=…etc’, but that doesn’t work. NOTE: the single quote in zxcZoom is required (object needed).
Anybody that can help me out here? Thanks!
This may be a third party plugin and I’ll end up shifting it to the ‘plugins’ forum. However, let’s take a look at the code your using in the template, see if we spot anything obvious. Also- note that the docs suggest using quote tags instead of double quotes- which may make a difference.
what kind of quote tags do you mean?
I am using this code in my template:
{exp:replace find='width="100"' replace='width="100" onmouseover="alert('test');" onMouseOut="zxcZoom(this);” '} {image} {/exp:replace}
and I’ve tried:
{exp:replace find='width="100"' replace='width="100" onmouseover="alert(\'test{{SINGLEQUOTE:ff6bc6875c6df1d586eada9901889742}});" onMouseOut="zxcZoom(this);” '} {image} {/exp:replace}
both don’t work..
Keep in mind- this is a third party plugin, so not officially supported. And I don’t have it installed to test. But according to the docs:
If you want to use a double quote in a parameter value, use the string “QUOTE” instead.
So going by that, I’d be trying something like:
{exp:replace find="width=QUOTE100QUOTE" replace="width=QUOTE100QUOTE etc...
It’s the first thing I’d try. And if that doesn’t work, the plugin author may have a better idea. I’ll go ahead and shift this down to the third party plugin forums- you’ll likely get a response from folks using the plugin there.
Make sense?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.