/    Sign up×
Community /Pin to ProfileBookmark

javascript pop up on link

is it possible to click a link and when you click on it, a user agreement pops up and then from there they either can click ok to continue or they can click cancel to not go anywhere?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@adrianBJan 30.2008 — Hi Jai,

I would think that what you are looking for is possible.

You would have to have the alert load when the page loads. (after they click.)

Then if yes it continues to the page

and if no

then it would cancel out.

The exact syntax you would have to put together.

Hope this helps, I'm kind of new to Java Script myself.

adrian
Copy linkTweet thisAlerts:
@drewbJan 30.2008 — yes, just use the standard window.open() function to open the agreement window.

Inside the window, have two buttons:

<input type="button" name="button1" onclick="agree('yes');" value="I Agree" />

<input type="button" name="button2" onclick="agree('no');" value="I DO NOT agree" />

Then, inside the popup put this:

<script type="text/javascript">

function agree(check) {

if (opener && !opener.closed){

if(check) {

opener.location.href = 'newpage.php';

self.close();

} else {

// NOTHING

self.close();

}

}

}

</script>
×

Success!

Help @Baby_Jai spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...