[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Webpage question about some code

I have some code on a web page that checks a zip code when the user checks out of the shopping cart and puts in a pop up message telling the user that we don't ship to that zip code..

I have built a webpage to handle questions about the shipping issue and I want to put a link in the pop up message that tells the user to go to a different webpage for more information..

here is the code
        //handle error where product field 5 does not match either
    }
}
 

if(add_error == true){
    alert(add_error_message);
    forceRecalc();

} else{
    if(first_added=="Wine"){
        if(!wine_state_regex.test(ss_jQuery("input[name='zip_code']").val())){
            alert("Unfortunately we are unable to ship wine to your state at this time.  Please select a different shipping address.");
        }
    }
}

}

</script>


How would I change that pop up box to say "Unfortunately we are unable to ship wine to your state.  Please click HERE to our site that handles out of state wine shipments or please select a different shipping address"

the click here would be a webpage.  like http://www.domain.com/page.html

thanks!!
0
lefty431
Asked:
lefty431
  • 3
1 Solution
 
COBOLdinosaurCommented:
You cannot put a link inside of an alert.  You will need to have some kind of hidden container with the message and link. then for the error handling you change the display properties of the container.

There are several ways to implement it, but I think it will be easier if you post a link to the site.

Cd&
0
 
lefty431Author Commented:
the site is
www.piwine.com

if you search for a wine.  and then check out.  but put a zip code in from anywhere but Pa you will see the notice.  

I want people to get pointed to a page that allows you to check out through a third party.  that stuff isn't important, I just want the user to be directed to the page after they see the message.
0
 
COBOLdinosaurCommented:
Okay just after the body add:

<div id="Emsg" 
style=position:absolute;left:300px;top:300px;height:250px;width:300px;
color:black;background-color:white;z-index:20;display:none;">

Unfortunately we are unable to ship wine to your state.  Please 
<a href="http://www.domain.com/page.html">click HERE</a>  to our site that handles out of state wine shipments or please select a different shipping address.

<button onclick="document.getElementById('Emsg').style.display='none';" 
value="close">close</button></div>

Open in new window


then change the test condition code to:
if(!wine_state_regex.test(ss_jQuery("input[name='zip_code']").val())){
document.getElementById('Emsg').style.display='block';

Open in new window



Cd&
0
 
COBOLdinosaurCommented:
I edited the topic list to remove JAVA, as the question has absolutely nothing to do with JAVA.

COBOLdinosaur, Topic Advisor
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now