New to the forum so first off, hello!

I have a code that shows an alert box only once when a user views a page. What I need is a cancel button that will bring the user back to the previous page they were on if clicked. If they press cancel they would then continue to recieve the pop-up.

Thanks for the help!


//Alert message once script- By JavaScript Kit
//Credit notice must stay intact for use
//Visit for this script

//specify message to alert
var alertmessage= "Please click on OK to continue loading my page, or CANCEL to be directed to the Yahoo site."

///No editing required beyond here/////

//Alert only once per browser session (0=no, 1=yes)
var once_per_session=1

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
  return returnvalue;

function alertornot(){
if (get_cookie('alerted')==''){

function loadalert(){

if (once_per_session==0)