farban6 Posted November 4, 2011 Share Posted November 4, 2011 Javascript isnt my strong point, and im trying to embed js into a php echo which is proving very differcult. So I have two links that open up popup pages. The first opens up a normal page, the second opens up a page which passes get varibles. The second link I am having problems with, so far this works <script type="text/javascript"> function open_win_input() { window.open("input.php",'_blank', "width=800,height=300"); } </script> <a href="javascript:void(0);" onclick="open_win_input();">Insert Appointment</a> But when I try to make a second link for edit, none of the javascript functionaly works for either links <script type="text/javascript"> function open_win_input() { window.open("input.php",'_blank', "width=800,height=300"); } function open_win_edit(d,s) { window.open("edit.php?date_id=" + d"&status="+ s,'_blank', "width=800,height=300"); } </script> <?php echo "<a href='javascript:void(0);' onclick=\"open_win_edit('".$result['date_id'].','.$result['status']."')\">Edit</a>"; ?> Any help would be very appreciated Quote Link to comment Share on other sites More sharing options...
joe92 Posted November 4, 2011 Share Posted November 4, 2011 You haven't put the speech marks back in when joining the two variables together: echo "<a href='javascript:void(0);' onclick=\"open_win_edit('".$result['date_id']."','".$result['status']."')\">Edit</a>"; Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted November 4, 2011 Share Posted November 4, 2011 I personally like this method.. <a href='javascript:void(0);' onclick="open_win_edit("<?php echo $result['date_id']; ?>","<?php echo $result['status']; ?>")">Edit</a>"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.