我在灯箱中使用JavaScript时遇到问题:我已经为我的网站实施了评级功能。当我使用普通嵌入式html中的功能时,它工作得很好但是用户被带到了反馈页面。我想使用灯箱进行反馈,以便用户提供反馈并留在实际位置。
现状:一切正常,但JS脚本无法在灯箱中启动。意味着评级的单选按钮不会被带有星形图像的脚本替换。最后我收到了这个错误:
TypeError:starRating未定义 starRating.create( 'feedbackSelect。');
当我从Firebug中复制错误时,我收到了这个:
TypeError:starRating未定义 http://xxx.xxx.xxx.xxx/xxxx/interface/themes/blueprint/js/jquery.min.js/eval/seq/2第2行
var starRating在更多行中定义:
var starRating = {
create: function(selector) {
...
让我感到困惑的是,Firebug指的是另一个文件,即jQuery库,并且再次:没有灯箱,它可以正常工作。我会感谢任何提示如何解决这个问题!
p.d。:这是一个聪明的HTML代码:
{js filename="feedback.js"}
{* <div class="span-5 {if $sidebarOnLeft}pull-18 sidebarOnLeft{else}last{/if}">
{include file="MyResearch/menu.tpl"}
</div> *}
<div class="span-18{if $sidebarOnLeft} push-5 last{/if}">
{if $user->cat_username}
<h1>{translate text='Feedback'}</h1>
<br>
{if $success}
<p class="success">{translate text='feedback_thanks'}</p>
{else}
{if $errorMsg}
<p class="error">{translate text=$errorMsg}</p>
{/if}
<form method="post" action="{$url}/Feedback/Feedback" id="feedback_form">
<input type="hidden" name="hash" value="{$hash|escape}" />
<table id="feedback" class="citation">
{if $feedbackIssues}
{foreach from=$feedbackIssues item=issue}
<tr>
<th>{translate text=$issue->title}:</th>
<td class="feedbackSelect">
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-1"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-1" name="issue{$issue->id|escape}" type="radio" value="1"/>0.5</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-2"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-2" name="issue{$issue->id|escape}" type="radio" value="2"/>1</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-3"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-3" name="issue{$issue->id|escape}" type="radio" value="3"/>1.5</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-4"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-4" name="issue{$issue->id|escape}" type="radio" value="4"/>2</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-5"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-5" name="issue{$issue->id|escape}" type="radio" value="5"/>2.5</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-6"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-6" name="issue{$issue->id|escape}" type="radio" value="6"/>3</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-7"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-7" name="issue{$issue->id|escape}" type="radio" value="7"/>3.5</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-8"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-8" name="issue{$issue->id|escape}" type="radio" value="8"/>4</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-9"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-9" name="issue{$issue->id|escape}" type="radio" value="9"/>4.5</label>
<label for="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-10"><input id="{$issue->title|lower|regex_replace:'/[^a-z0-9]/':''|escape}-10" name="issue{$issue->id|escape}" type="radio" value="10"/>5</label>
</td>
</tr>
{/foreach}
{/if}
<tr>
<th>{translate text="Comments"}:</th>
<td><textarea name="comment" class="formularLarge">{$comment}</textarea></td>
</tr>
<tr>
<th> </th>
<td><input type="submit" name="submitFeedback" value="{translate text="submit_feedback"}" class="senden"></td>
</tr>
</table>
</form>
{/if}
{else}
{include file="AJAX/login.tpl"}
{/if}
</div>
<div class="clear"></div>