Forum Moderators: coopster
I have a functionlist that i use to store the repeating page elements - basic stuff.
One of the functions contains javascript and php will not accept this and makes a parse error. How can i contain the javascript in the function so that both php can contain it and so that the result on the page is working javascript.
the function:function script() {
echo '<a href="foo" id="d" title="" onMouseOver="MM_shl('bug','','show')" onClick="MM_shl('bug','','show')"
onBlur="MM_shl('bug','','hide')" onMouseOut="MM_shl('bug','','hide')">foo</a>';
}
calling the function:
<?php script()?>
kind regards
/Hafnius
I would also use double quotes around the whole string but thats me and since I feel badly
echo "<a href=\"foo\" id=\"d\" title=\"\" onMouseOver=\"MM_shl('bug','','show')\" onClick=\"MM_shl('bug','','show')\" onBlur=\"MM_shl('bug','','hide')\" onMouseOut=\"MM_shl('bug','','hide')\">foo</a>";
function script() {
?>
<a href="foo" id="d" title="" onMouseOver="MM_shl('bug','','show')" onClick="MM_shl('bug','','show')"
onBlur="MM_shl('bug','','hide')" onMouseOut="MM_shl('bug','','hide')">foo</a>
<?php
}