Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop-Up Window from If Else Statement 1

Status
Not open for further replies.

lanm

Programmer
Jul 7, 2005
244
US
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.
 
Just add a javascript function using Page.RegisterStartupScript()


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
And here's a quick example to incorporate using the events from the javascript popup:
Code:
        Dim strJavaScript As New StringBuilder
        strJavaScript.Append("<SCRIPT language = JavaScript>" & Environment.NewLine)
        strJavaScript.Append("ConfirmStatus = confirm(""Can I write something to the page?"")" & Environment.NewLine)
        strJavaScript.Append("if (ConfirmStatus == true) {" & Environment.NewLine)
        strJavaScript.Append("document.write(""OK, I will then!"");}" & Environment.NewLine)
        strJavaScript.Append("</SCRIPT>")
        Page.RegisterStartupScript("mytest", strJavaScript.ToString)


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top