tezza42 Posted September 21, 2010 Share Posted September 21, 2010 I am using the following piece of code to open a new window when a checkbox is checked... <INPUT type="checkbox" name="name" value="YES" onClick="window.open('/somepage.php?do=something&id=<?php echo $SOMEID["id"] ?>','','width=600,height=350,left=100,top=100,screenX=100,screenY=100')"> The page opens ok when the checkbox is ticked (checked). PROBLEM: The page opens again if the checkbox is un-ticked (un-checked). I just want to open the page if the checkbox is ticked only but not sure how to do this? OTHER INFO: Seperate checkboxes are dynamically created on the page for each id=<?php echo $SOMEID["id"] ?> Link to comment https://forums.phpfreaks.com/topic/214015-if-checkbox-checked-problem/ Share on other sites More sharing options...
the182guy Posted September 21, 2010 Share Posted September 21, 2010 <script type="text/javascript"> function doPopup(id, isChecked) { if(isChecked) { window.open('/somepage.php?do=something&id=' + id,'','width=600,height=350,left=100,top=100,screenX=100,screenY=100'); } } </script> <INPUT type="checkbox" name="name" value="YES" onClick="doPopup('<?php echo $SOMEID["id"] ?>', this.checked)"> Link to comment https://forums.phpfreaks.com/topic/214015-if-checkbox-checked-problem/#findComment-1113747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.