I'm trying to do table where pressing on ID, it opens popup window, where will be menu, for example, change row values, add comments.. But I have a problem with generating link for each row:
foreach ($results as $row) {
// Each $row is a row from the query
$rowid = $row->ID;
echo '<tr><td>';
echo '<a href="#" onclick="javascript:window.open("http://192.168.210.140/todolist/controls-menu?funnelid="'.$rowid.',"Controls Menu","width= 700,height= 500,toolbar= no,location= no,directories= 0,status= no,menuBar= no,scrollBars= no,resizable= yes,left= 400,top= 150,screenX= 400,screenY= 150");">'.$rowid.'</a>';
Maybe it's need to add
<script type="text/javascript>
... Some script when pressing <a href="#">
</script>
But I have no idea, how to detect from script which link is pressed, for example is it
http://192.168.210.140/todolist/controls-menu?funnelid=999
OR
http://192.168.210.140/todolist/controls-menu?funnelid=1100
P.S. I'm using Wordpress.
asked Aug 25, 2015 at 7:29
AlexIL
5733 gold badges9 silver badges24 bronze badges
1 Answer 1
HTML Code
<?php $id=1;?>
<a href="" onClick="popitup('popup1.php?id=<?php echo $id;?>')">Open</a>
Javascript Code
<script type="text/javascript">
function popitup(url) {
newwindow=window.open(url,'name','height=200,width=150');
if (window.focus) {newwindow.focus()}
return false;
}
</script>
answered Aug 25, 2015 at 7:56
Blue Rose
5331 gold badge4 silver badges14 bronze badges
default
aelement:onclick="javascript:window.open("http...closes theonclicksection right after the opening bracket!atag quotations, you are placing"inside of"for onclick value. If we won't use proper quotations, then theatag output will not come as expected. Use escape characters,onclick="javascript:window.open(`http....