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

cant get dumb confirmation script to work...

Status
Not open for further replies.

estesflyer

Programmer
Dec 19, 2000
284
US
i try this, but it just doesnt wanna work for some reason.... anyone know why??


<script language=&quot;javascript&quot;>
<!--
function confirmation()
{
var confirmbox = confirm(&quot;Warning - By entering this site, you agree to our dislcaimer, do you wish to continue?&quot;);
if (confirmbox)
{
window.location.href = &quot;main.asp&quot;;
}
else
{
window.location.href = &quot;}
//-->
</script>
 
Works for me? What happens for you?
b2 - benbiddington@surf4nix.com
 
Do you have a button or textfield called the same as the function or a variable?
 
no, i have a link, and im sure that the link calls the function correctly, and that is the only link or any other object in mah page.
the confirm box DOES come up, but it doesnt work when i hit cancel.
 
The only problem I can see is that you're missing a closing brace for your function, but that's probably just a copy and paste error.

What exactly happens when you hit Cancel and what browser/platform are you testing it on?

Russ
bobbitts@hotmail.com
 
If you are calling it in href=javascript:function() - try it in an onClick instead - I have had weird results when returning values from code called in this maner. Sometimes it will get written to the page.

Maybe try holding it's hand and adding if(!confirmation) - trivial I know - but it should be working?
b2 - benbiddington@surf4nix.com
 
Sorry ignore that - I pasted your code and it works perfectly. (?)
b2 - benbiddington@surf4nix.com
 
well, if i try it w/out my server, it opens the directory the file is in, inside the browser window. When i view the page in my server, then it just reloads the page....

btw, all the above results happen when i hit cancel.

when i hit ok, the same results apply.


TIA

- Rusty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top