Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Java Script popup window w/ If Else Statement

Author  Topic 

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2005-10-19 : 10:02:08
I'm a bit new to the java script side of things.

I want to have a pop-up window come up under a conditional statement like:

If variable > 1 then
Pop-up window
Else
other code

I know when I've used java script with my other code, it's been with button click events and no conditional statement.

Do I still have to have the attribute initialized in the Page_Load event? Any examples out there? I'd like to be able to use the "Yes" / "No" button events from this pop-up window too.

SamC
White Water Yakist

3467 Posts

Posted - 2005-10-19 : 12:07:04
The whole trick is to initialize the variable before the JavaScript IF is executed.

It isn't hard to do. I don't have a handy example, but I suspect if you Google you could find a solution.

Then there is the whole every-browser-in-the-universe is disabling pop-ups. So why bother?

The better solution is to present a link/button which when clicked will pop-up a window (or make a hidden <DIV> of content display.)
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-10-19 : 16:09:32
<Mr Mackie>Pop-ups are bad, mmmmkay?</Mr Mackie>.
Sam's suggestions are the way to handle this IMHO.
'Hide
mydiv.style.display = none;

'UnHide
mydiv.style.display = block;

Michael



<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>
Go to Top of Page
   

- Advertisement -