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"] ?> Quote Link to comment 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)"> 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.