这是ajax的代码
$(function(){ $('#core123').mouseover(function(){ var $tip=$('<div id="tip"><div class="t_box"><div><s><i></i></s><img src="temp/images/synonyms/core123.jpg" /></div></div></div>'); $('body').append($tip); $('#tip').show('fast'); }).mouseout(function(){ $('#tip').remove(); }).mousemove(function(e){ $('#tip').css({"top":(e.pageY-60)+"px","left":(e.pageX+30)+"px"}) }) }) 这是页面<div class="td_01_1" style="cursor:pointer;" onClick="load()" id="core123">1345</div>
单独测试没问题 ,通过网站运行就有问题:报错
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "../templates\tongyici/index.html" on line 88 "$('#tip').css({"top":(e.pageY-60)+"px","left":(e.pageX+30)+"px"})" - Unexpected ":", expected one of: "}" , " "' in D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templatecompilerbase.php:441 Stack trace: #0 D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templateparser.php(2889): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templateparser.php(2954): Smarty_Internal_Templateparser->yy_syntax_error(2, ':') #2 D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_smartytemplatecompiler.php(51): Smarty_Internal_Templateparser->doParse(2, ':') #3 D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templatecompilerbase.php(82): Smarty_Internal_SmartyTemplateCompiler->doCompile('<!DOCTYPE html ...') #4 D:\AMP\thirdHost\petdog2\smart in D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 441
求解,大侠
$(function(){ $('#core123').mouseover(function(){ var $tip=$('<div id="tip"><div class="t_box"><div><s><i></i></s><img src="temp/images/synonyms/core123.jpg" /></div></div></div>'); $('body').append($tip); $('#tip').show('fast'); }).mouseout(function(){ $('#tip').remove(); }).mousemove(function(e){ $('#tip').css({"top":(e.pageY-60)+"px","left":(e.pageX+30)+"px"}) }) }) 这是页面<div class="td_01_1" style="cursor:pointer;" onClick="load()" id="core123">1345</div>
单独测试没问题 ,通过网站运行就有问题:报错
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "../templates\tongyici/index.html" on line 88 "$('#tip').css({"top":(e.pageY-60)+"px","left":(e.pageX+30)+"px"})" - Unexpected ":", expected one of: "}" , " "' in D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templatecompilerbase.php:441 Stack trace: #0 D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templateparser.php(2889): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templateparser.php(2954): Smarty_Internal_Templateparser->yy_syntax_error(2, ':') #2 D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_smartytemplatecompiler.php(51): Smarty_Internal_Templateparser->doParse(2, ':') #3 D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templatecompilerbase.php(82): Smarty_Internal_SmartyTemplateCompiler->doCompile('<!DOCTYPE html ...') #4 D:\AMP\thirdHost\petdog2\smart in D:\AMP\thirdHost\petdog2\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 441
求解,大侠
$('#tip').css({"top":(e.pageY-60)+"px","left":(e.pageX+30)+"px"}) 这句能不能变换掉
{literal}
script
{/literal}
标签
$('#tip').css({ "top":(e.pageY-60)+"px","left":(e.pageX+30)+"px" })