We help IT Professionals succeed at work.
Get Started

Popup if a certain input form's checkbox is checked

deloused
deloused asked
on
560 Views
Last Modified: 2010-05-18
I need to have a new browser window open (via a popup or otherwise) if a user checks a checkbox on a page.  If the user doesn't check the popup, I would like for the popup to not happen.  

The page is a simple input form that users enter to recieve more information.  I have the popup part figured out, but I can't seem to get it to fire only when the checkbox is checked.

I've attached my sample code below to give an idea, I just need to add an if statement based to determine if the checkbox is checked and whether or not to fire the popup event.  Thanks in advance


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
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=1,width=600,height=800,left = 0,top = 0');");
 
}
// End -->
</script>
</head>
<body>
    <form method="POST">
	
	<input  id="CheckboxForPopup" name="CheckboxForPopup" type="checkbox" value="1"   /> 
	
	<input style="height: 35px" type="submit" name="submit" value="Submit" onclick="javascript:popUp('popup.html')" />
 
</body>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Expert of the Year 2008
Top Expert 2008
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE