Advertisement
gr125

Untitled

Mar 28th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.90 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html oncontextmenu="return false">
  3.  
  4. <body>
  5.  
  6. <script>
  7. function checkZipCode()
  8.     {
  9.         var validZipCodes = ["00001", "00002", "00003", "00004", "00005", "00006", "00007", "00008", "00009", "00010", "00011", "00012", "00013", "00014", "00015", "00016", "00017" ];
  10.         var enteredZipCode = document.getElementById("inputZip").value;
  11.        
  12.         if(validZipCodes.indexOf(enteredZipCode) > -1)
  13.        
  14.         {
  15.           document.getElementById("Message").innerHTML = "We do service " + enteredZipCode + "!";  
  16.         }
  17.         else
  18.         {
  19.          document.getElementById("Message").innerHTML = "Sorry, we don't service this area yet.<br><br>But please give us a call to see if we can help you.";
  20.         }
  21.        
  22.         document.getElementById("Message").style.display = "block";
  23.        
  24.     }
  25. </script>
  26.  
  27.  
  28. <style>
  29.     h1 {font-family: "Trebuchet MS";
  30.     color: #fe007e;
  31.     font-size: 35px;
  32.     margin-bottom: 1px;
  33.     }
  34.    
  35.    .search-btn {
  36.    outline: none;
  37.     display:block;
  38.     float:left;
  39.     width:20%;
  40.     text-align:center;
  41.     font-family:"proxima-nova", sans-serif;
  42.     text-transform:uppercase;
  43.     font-size:15px;
  44.     font-weight:bold;
  45.     color:#FFF;
  46.     background-color:#fe007e;
  47.     -webkit-border-radius: 0 3px 3px 0;
  48.     border-radius: 0px 50px 50px 0px;
  49.     cursor:pointer;
  50.     border:none;
  51.     height:40px;
  52.     font-family:Arial;
  53. }
  54.  
  55. .search-box {
  56.     outline: none;
  57.     width:73%;     
  58.     padding:10px 3%;
  59.     display:block;
  60.     float:left;
  61.     background:#dadada;
  62.     color:#3F3F3F;
  63.     font-family:"proxima-nova", sans-serif;
  64.     font-size:15px;
  65.     height:20px;
  66.     -webkit-border-radius: 3px 0 0 3px;
  67.     border-radius: 50px 0 0 50px;
  68.     border:none;
  69.     font-family:Arial;
  70. }
  71.  
  72. #ZipSearchBox {
  73.     width:90%;
  74.     background-color: #fbfcfb;
  75.     text-align:center;
  76.     margin:0px auto;
  77.     padding: 0px 10px;
  78.     border:solid 1px #dddddd;
  79.     font-family:Arial;
  80.    
  81. }
  82. #ZipSearchBox h2{
  83.     margin-bottom:8px;
  84.     font-size:22px;
  85.     font-family:Arial;
  86.     filter: alpha(opacity=80);
  87.     opacity: 0.8;
  88.    
  89. }
  90.  
  91. </style>
  92.  
  93.  
  94.  
  95. <div id="ZipSearchBox">
  96. <h1>
  97.     AREAS WE SERVICE
  98. </h1>
  99.  
  100. <h2>
  101.     Check to see if we work in your area.
  102. </h2>
  103.  
  104. <form id="zipform">
  105.  
  106. <div style="margin:auto; padding:20px">
  107.  
  108. <input id="inputZip" class="search-box" type="text" value="Enter your zip code" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">
  109. <input class="search-btn" id="button" type="button" value="Go" onclick="checkZipCode();"/>
  110.  
  111. <script>
  112. var input= document.getElementById("inputZip");
  113. input.addEventListener("keydown", function (e) {
  114.     if (e.keyCode === 13) {  //checks whether the pressed key is "Enter"
  115.         checkZipCode();
  116.     }
  117. });
  118. </script>
  119.  
  120. </div>
  121.    
  122. </form>
  123.  
  124. <br>
  125. <br>
  126.  
  127.      <h2 style="background-color:#272a26; padding:15px; color:#fff; font-family:Arial; font-size: 20px; display:none" id="Message">
  128.        
  129.     </h2>
  130.    
  131.    
  132. </div>
  133.  
  134. </body>
  135.  
  136. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement