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 badges2 Answers
Reset to default 2You 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>