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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alerts

Status
Not open for further replies.

dvannoy

MIS
Joined
May 4, 2001
Messages
2,765
Location
US
i have been playing with Alerts and was wondering if someone can anwser a few questions for me.

Response.Write &quot;<SCRIPT>&quot;
Response.Write&quot; alert('Hello...');&quot;
Response.Write &quot;history.back();&quot;
Response.Write &quot;</SCRIPT>&quot;
Response.end

OK, when this alert gets fired off it brings up a messagebox saying &quot;Hello&quot; with an OK button. once the button is pressed it goes back to the page where the button was pressed.

How do you use Yes/No Alerts?
my next question is once I am using Yes/No alerts, how do I code something behind the yes or no buttons? say I throw up an alert asking &quot;Do You Wish to Lof Off?&quot; if the user hits Yes, I will redirect him somewhere else. If the user hits No, I will put him to the last page.

any thoughts or help would be appreciated

Thanks
 
<script LANGUAGE=&quot;JavaScript&quot;>
<!--
function confirmSubmit()
{
var agree=confirm(&quot;Are you sure you wish to continue?&quot;);
if (agree)
return true ;
window.location = &quot;page1.aspx&quot;
else
return false ;
}
// -->
</script>

Here's some javascript that brings up a yes/no message box and either redirects to a new page or returns to the calling page.

hth,
drew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top