dongtang9855 2015-06-22 17:07
浏览 45
已采纳

错误:预期表达式,脚本结束

When clicking on the "Print Ticket" button Javascript is throwing an syntax error in firebug indicating "Expected expression, got end of script" However this is a straight forward bit of php/javascript code so i'm at a loss for the syntax problem. This button is not addressed by any Jquery function and I don't see any conflicting single/double quotes???

enter image description here

echo "<div style='height:550px; width:900px;' id='btarget'><div id='tcontrol'>";

if ($var1v!=="Paid" && $_SESSION['tickstatus']!=="Closed,Complete") {echo "<input name='reschtick' id='reschtick' type='button' value='RESCHEDULE' /><input name='closetick' id='closetick' type='button' value='CLOSE TICKET' />";}
echo $varv1;
echo '<input type="button" value="PRINT TICKET" onclick="http://www.thetargetdomain.com/ops/includes/pdfconveview.php?dispinv='.$_GET[vtick].'&action=eview" />';
echo "</div>

If I view this in source i get:

<input type="button" onclick="http://www.thetargetdomain.com/ops/includes/pdfconveview.php?dispinv=06151205&amp;action=eview" value="PRINT TICKET">

if I enter in the SRC url as shown above directly into the browser it works fine. It just has some issue with triggering from the button click.

  • 写回答

3条回答 默认 最新

  • douche5961 2015-06-22 17:10
    关注

    That makes no sense. You are assigning a URL to a onclick, that is wrong.

    If you want to go to a page, you need to set the window location or wrap the button in an anchor.

    onclick="window.location.href='http://www.example.com';"
    

    Using inline events is bad practice.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line