Solved

Webpage question about some code

Posted on 2013-11-05
7
260 Views
Last Modified: 2013-12-02
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
Comment
Question by:lefty431
  • 3
7 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39624629
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
 
LVL 1

Author Comment

by:lefty431
ID: 39624731
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
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 39625008
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 39625182
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39625978
I edited the topic list to remove JAVA, as the question has absolutely nothing to do with JAVA.

COBOLdinosaur, Topic Advisor
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now