doumiang0597 2013-07-30 05:22
浏览 87
已采纳

href with onclick javascript弹出窗口

i have this javascript:

<SCRIPT LANGUAGE="JavaScript">
<!-- 

// Generated at http://www.csgnetwork.com/puhtmlwincodegen.html 
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=400,left = 283,top = -16');");

}

// -->
</script>

i want to use an href with a javascript popup function but its not working. here is my code

 <?php
    echo "<a href = '#' onClick='javascript:popUp('editdelete.php?emoticon_text=$emoticon_text&id=$id')'><img src='update.png'></a>";
    ?>

but its not working

(the $emoticon_text and the $id will be passed to the pop up window using $_GET function.)

thanks

  • 写回答

2条回答 默认 最新

  • dongyiyu882684 2013-07-30 05:23
    关注

    You are mixing your quotes usage. Please try the following:

    <a href = '#' onClick='javascript:popUp("editdelete.php?emoticon_text=$emoticon_text&id=$id")'><img src='update.png'></a>
    

    Note the double quotes inside javascript:popUp inplace of single quote as you have in your question.

    Update:

    After OP's comment below:

    <?php echo "<a href = '#' onClick='javascript:popUp(\'editdelete.php?emoticon_text=$emoticon_text&id=$id\')'‌​><img src='update.png'></a>"; ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏