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

confirmation script not working...

Status
Not open for further replies.

estesflyer

Programmer
Dec 19, 2000
284
US
ok, if you know js, you can read what this is doing...
for some odd reason, when i hit cancel, the script does NOT work. the page only refreshes...



script language="javascript">
<!--
function NewWindow()
{
var confirmalert=window.confirm(&quot;Warning - By entering this site, you agree to our dislcaimer, do you wish to continue?&quot;);

if (confirmalert)
{
window.open(&quot;top.self.close();
}
else
{
window.location = &quot;}
}
//-->
</script>


plz note also, that the link triggering the function, is the following...

<a href=&quot;&quot; onClick=&quot;NewWindow()&quot;>Enter</a>

i have a fealing that its the href=&quot;&quot; that is the problem. but i want the script to overpower that. plz lemme know what i can do. :)

thx for your help
 
try href='javascript:void(0)'.
b2 - benbiddington@surf4nix.com
 
or <a href=&quot;javascript: NewWindow()&quot;>Enter</a> !!!

They'll all work.. and take out the semi-colon in the window.open line after .asp&quot; or you won't get your new window..

Matt.
 
oh ok. so like, add the whole line into the script??

like,

script language=&quot;javascript&quot;>
<!--
function NewWindow()
{


href='javascript:void(0)'. //this line goes here?



var confirmalert=window.confirm(&quot;Warning - By entering this site, you agree to our dislcaimer, do you wish to continue?&quot;);

if (confirmalert)
{
window.open(&quot;top.self.close();
}
else
{
window.location = &quot;}
}
//-->
</script>



btw, what does the javascript:void(0) mean??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top