Click to See Complete Forum and Search --> : need script that alerts w/ popup external site is being accessed
equestrienne
10-16-2003, 11:44 AM
I'm doing work for a financial institution that is required to have an alert pop up, with an "Accept" button and disclaimer, for all links to external sites. I found a script a while back that was perfect but somehow lost it and have had no luck finding it again. Naturally <lol> my deadline was yesterday!
Any help would be most appreciated. Thanks.
Sue
96turnerri
10-16-2003, 11:56 AM
somethging like this?
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
agree = 0; // 0 means 'no', 1 means 'yes'
</script>
</HEAD>
<BODY>
<center>
<form name=enableform>
You can only enter your name if you agree to the terms. (just a demo)<br>
<br>
<input type=radio name='enable' value='agree' onClick="agree=1; document.enableform.box.focus();">I agree<br>
<input type=radio name='enable' value='disagree' onClick="agree=0; document.enableform.box.value='';">I disagree<br>
Please enter your name:
<input type=text name=box onFocus="if (!agree)this.blur();" onChange="if (!agree)this.value='';" size=12>
<br>
<br>
<input type=submit value="Done!">
</form>
</center>
equestrienne
10-16-2003, 12:16 PM
Sort of but not quite.
The script I'd found before caused a small pop up (with the disclaimer and accept button) to appear when a user selected a link that took them to an external site. There was code between <head> tags and in <body> and in the link itself. The user couldn't leave our site or go to the new one until they acknowledged that the new site was not connected in any way with the credit union site. After they hit the "Accept" button, they were then automatically taken to the new site, which opened in a new window.
I'm probably not explaining very well so please forgive me for sounding so stupid. I'm obviously not very good with JavaScript, but pretty darn good at cut and paste.
Thanks again.
Sue
Charles
10-16-2003, 12:37 PM
Give the folowing a try online but note that it does not seem to work locally.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<script type="text/javascript">
<!--
onload = function () {for (var i=0; i<document.links.length; i++) {if (new RegExp ('^' + location.host, '').test ('document.links[i].href')) document.links[i].onclick = function () {return confirm('Are you sure?', '')}}}
// -->
</script>
<ul>
<li><a href="foo.html">foo</a></li>
<li><a href="http://www.w3.org/">W3C</a></li>
</ul>
96turnerri
10-16-2003, 05:16 PM
Originally posted by equestrienne I'm obviously not very good with JavaScript, but pretty darn good at cut and paste.
lmao :D