最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - href with onclick javascript pop-up - Stack Overflow

programmeradmin3浏览0评论

i have this javascript:

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

// Generated at .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

i have this javascript:

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

// Generated at http://www.csgnetwork./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

Share Improve this question edited Jul 30, 2013 at 5:31 Christian Burgos asked Jul 30, 2013 at 5:22 Christian BurgosChristian Burgos 1,5919 gold badges28 silver badges50 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

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 ment below:

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

should be

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

评论列表(0)

  1. 暂无评论