Advertisement
computeroverhauls

Untitled

Jul 11th, 2017
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.63 KB | None | 0 0
  1. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  2. <script>
  3. // handles the click event for link 1, sends the query
  4. function getOutput() {
  5. var model = document.getElementById('model').value;
  6. var carrier = document.getElementById('carrier').value;
  7. var condition = document.getElementById('condition').value;
  8. var storage = document.getElementById('storage').value;
  9. if(model == '' || carrier == '' || condition == '' || storage == ''){
  10. var container = document.getElementById('output');
  11. container.innerHTML = '<h3>Please fill out all of the form fields</h3>';
  12. $('#outputcont').show(300);
  13. }else{
  14. getRequest(
  15. 'quotest/PHPExcel/getQuote.php?model=' + model + "&condition=" + condition + '&storage=' + storage + '&carrier=' + carrier , // URL for the PHP file
  16. drawOutput, // handle successful request
  17. drawError // handle error
  18. );
  19. }
  20. return false;
  21. }
  22. // handles drawing an error message
  23. function drawError() {
  24. var container = document.getElementById('output');
  25. container.innerHTML = 'Please try again later or contact us at info@computeroverhauls.com';
  26. }
  27. // handles the response, adds the html
  28. function drawOutput(responseText) {
  29. $('#outputcont').show(300);
  30. var container = document.getElementById('output');
  31. container.innerHTML = responseText;
  32. }
  33. // helper function for cross-browser request object
  34. function getRequest(url, success, error) {
  35. var req = false;
  36. try{
  37. // most browsers
  38. req = new XMLHttpRequest();
  39. } catch (e){
  40. // IE
  41. try{
  42. req = new ActiveXObject("Msxml2.XMLHTTP");
  43. } catch(e) {
  44. // try an older version
  45. try{
  46. req = new ActiveXObject("Microsoft.XMLHTTP");
  47. } catch(e) {
  48. return false;
  49. }
  50. }
  51. }
  52. if (!req) return false;
  53. if (typeof success != 'function') success = function () {};
  54. if (typeof error!= 'function') error = function () {};
  55. req.onreadystatechange = function(){
  56. if(req.readyState == 4) {
  57. return req.status === 200 ?
  58. success(req.responseText) : error(req.status);
  59. }
  60. }
  61. req.open("GET", url, true);
  62. req.send('');
  63. return req;
  64. }
  65. $(document).ready(function(){
  66. $("#1").hide(); //Hides all the capacity fields
  67. $("#2").hide();
  68. $("#3").hide();
  69. $("#4").hide();
  70. $("#5").hide();
  71. $('#model').change(function(e){
  72. if($(this).val() == "ip7p"){ //Only show the right capacity field for the right model, hide all others
  73. $('#storage').val($('256GB'));
  74. $("#1").show();
  75. $("#2").show();
  76. $("#3").hide();
  77. $("#4").show();
  78. $("#5").hide();
  79. }
  80. if($(this).val() == "ip7"){
  81. $('#storage').val($('256GB'));
  82. $("#1").show();
  83. $("#2").show();
  84. $("#3").hide();
  85. $("#4").show();
  86. $("#5").hide();
  87. }
  88. if($(this).val() == "ip6sp"){
  89. $('#storage').val($('128GB'));
  90. $("#1").hide();
  91. $("#2").show();
  92. $("#3").show();
  93. $("#4").show();
  94. $("#5").show();
  95. }
  96. if($(this).val() == "ip6s"){
  97. $('#storage').val($('128GB'));
  98. $("#1").hide();
  99. $("#2").show();
  100. $("#3").show();
  101. $("#4").show();
  102. $("#5").show();
  103. }
  104. if($(this).val() == "ipse"){
  105. $('#storage').val($('128GB'));
  106. $("#1").hide();
  107. $("#2").show();
  108. $("#3").show();
  109. $("#4").show();
  110. $("#5").show();
  111. }
  112. if($(this).val() == "ip6p"){
  113. $('#storage').val($('128GB'));
  114. $("#1").hide();
  115. $("#2").show();
  116. $("#3").show();
  117. $("#4").hide();
  118. $("#5").show();
  119. }
  120. if($(this).val() == "ip6"){
  121. $('#storage').val($('128GB'));
  122. $("#1").hide();
  123. $("#2").show();
  124. $("#3").show();
  125. $("#4").hide();
  126. $("#5").show();
  127. }
  128. });
  129. $('#model').on('change', function() { //Removes the placeholder after anything has been selected
  130. if ( this.value !== 'none') //Also fades in the next dropdown
  131. {
  132. $("#modelplaceholder").hide();
  133. $("#storage").show(300);
  134. $("#storageHeader").show(300);
  135. }
  136. });
  137. $('#storage').on('change', function() {
  138. if ( this.value !== 'none')
  139. {
  140. $("#carrier").show(300);
  141. $("#carrierHeader").show(300);
  142. $("#storageplaceholder").hide();
  143. }
  144. });
  145. $('#carrier').on('change', function() {
  146. if ( this.value !== 'none')
  147. {
  148. $("#condition").show(300);
  149. $("#conditionHeader").show(300);
  150. $("#carrierplaceholder").hide();
  151. }
  152. });
  153. $('#condition').on('change', function() {
  154. if (this.value !== 'none')
  155. {
  156. var cond = '#' + $(this).val().toLowerCase();
  157. $(".blurb:not(" + cond +")").hide(300, function(){
  158. $(cond).show(300);
  159. });
  160. $(".btn").fadeIn(300);
  161. $("#conditionplaceholder").hide();
  162. }else{
  163. $(cond).show(300);
  164. }
  165.  
  166. });
  167. $("#ip7p").click(function () {
  168. if($('#model').val() == 'none'){
  169. $('#model').val('ip7p');
  170. $('#model').change();
  171. $(".modelscont").fadeOut(300);
  172. $(this).fadeIn(300);
  173. }else{
  174. $(this).fadeOut(function(){
  175. $('.modelscont').fadeIn(300);
  176. $('#model').val('none');
  177. });
  178. }
  179. });
  180. $("#ip7").click(function () {
  181. if($('#model').val() == 'none'){
  182. $('#model').val('ip7');
  183. $('#model').change();
  184. $(".modelscont").fadeOut(300);
  185. $(this).fadeIn(300);
  186. }else{
  187. $(this).fadeOut(function(){
  188. $('.modelscont').fadeIn(300);
  189. $('#model').val('none');
  190. });
  191. }
  192. });
  193. $("#ip6sp").click(function () {
  194. if($('#model').val() == 'none'){
  195. $('#model').val('ip6sp');
  196. $('#model').change();
  197. $(".modelscont").fadeOut(300);
  198. $(this).fadeIn(300);
  199. }else{
  200. $(this).fadeOut(function(){
  201. $('.modelscont').fadeIn(300);
  202. $('#model').val('none');
  203. });
  204. }
  205. });
  206. $("#ip6s").click(function () {
  207. if($('#model').val() == 'none'){
  208. $('#model').val('ip6s');
  209. $('#model').change();
  210. $(".modelscont").fadeOut(300);
  211. $(this).fadeIn(300);
  212. }else{
  213. $(this).fadeOut(function(){
  214. $('.modelscont').fadeIn(300);
  215. $('#model').val('none');
  216. });
  217. }
  218. });
  219. $("#ipse").click(function () {
  220. if($('#model').val() == 'none'){
  221. $('#model').val('ipse');
  222. $('#model').change();
  223. $(".modelscont").fadeOut(300);
  224. $(this).fadeIn(300);
  225. }else{
  226. $(this).fadeOut(function(){
  227. $('.modelscont').fadeIn(300);
  228. $('#model').val('none');
  229. });
  230. }
  231. });
  232. $("#ip6p").click(function () {
  233. if($('#model').val() == 'none'){
  234. $('#model').val('ip6p');
  235. $('#model').change();
  236. $(".modelscont").fadeOut(300);
  237. $(this).fadeIn(300);
  238. }else{
  239. $(this).fadeOut(function(){
  240. $('.modelscont').fadeIn(300);
  241. $('#model').val('none');
  242. });
  243. }
  244. });
  245. $("#ip6").click(function () {
  246. if($('#model').val() == 'none'){
  247. $('#model').val('ip6');
  248. $('#model').change();
  249. $(".modelscont").fadeOut(300);
  250. $(this).fadeIn(300);
  251. }else{
  252. $(this).fadeOut(function(){
  253. $('.modelscont').fadeIn(300);
  254. $('#model').val('none');
  255. });
  256. }
  257. });
  258.  
  259. });
  260. $(window).on('resize', function(){
  261. if ($(this).width() < 800) {
  262. $('#model').show();
  263. $('.modelscont').hide();
  264. }else if($('#model').val() == 'none'){
  265. $('#model').hide();
  266. $('.modelscont').show();
  267. }
  268. });
  269.  
  270. </script>
  271. <!-- Google Code for Add to Cart Conversion Page
  272. In your html page, add the snippet and call goog_report_conversion
  273. when someone clicks on the chosen link or button. -->
  274.  
  275. <style>
  276. #model{
  277. display:none;
  278. }
  279. #jumbotron{
  280. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  281. }
  282. .itemcont {
  283. display: flex;
  284. overflow: hidden;
  285. margin:15px;
  286. align-items: center;
  287. }
  288. .itemheader{
  289. margin-right: auto;
  290. }
  291. .modelscont{
  292. display:inline-block;
  293. background-color:white;
  294. border-radius:5px;
  295. padding:20px 20px 0px 20px;
  296. transition:background-color .25s, color .25s;
  297. user-select: none;
  298. -moz-user-select: none;
  299. -khtml-user-select: none;
  300. -webkit-user-select: none;
  301. -o-user-select: none;
  302. cursor:hand;
  303. margin-bottom:20px;
  304. border:solid #a5a5a5 1px;
  305. }
  306. #outputcont{
  307. display:none;
  308. margin:20px;
  309. }
  310. #output{
  311. font-size:3em;
  312. margin:20px;
  313. }
  314. .modelscont:hover {
  315. background-color:rgba(121, 169, 128, 1);
  316. }
  317. .modelscont:active{
  318. background-color:rgba(20, 20, 20, 0.73);
  319. color:#e2e2e2;
  320. }
  321. .models{
  322. height:75px;
  323. width:75px;
  324. }
  325. #model{
  326. margin:0 auto;
  327. }
  328. #output{
  329. margin-top:50px;
  330. }
  331. .btn {
  332. display:none;
  333. background-color:#44c767;
  334. -moz-border-radius:28px;
  335. -webkit-border-radius:28px;
  336. border-radius:10px;
  337. border:1px solid #18ab29;
  338. cursor:pointer;
  339. color:#ffffff;
  340. font-family:Arial;
  341. font-size:17px;
  342. padding:16px 31px;
  343. text-decoration:none;
  344. text-shadow:0px 1px 0px #2f6627;
  345. outline:none;
  346. }
  347. .btn:hover {
  348. background-color:#5cbf2a;
  349. }
  350. .btn:active {
  351. background-color:#169c23;
  352. position:relative;
  353. top:1px;
  354. }
  355. #jumbotron {
  356. width:100%;
  357. margin:0 auto;
  358. text-align:center;
  359. padding:20px 0 20px 0;
  360. border-radius:3px;
  361. }
  362. #5 {
  363. display:none;
  364. }
  365. #items{
  366. width:45%;
  367. margin:0 auto;
  368. }
  369.  
  370. select {
  371. border: 1px solid #ccc;
  372. border-radius: 3px;
  373. overflow: hidden;
  374. background: #fafafa ;
  375. display:inline-block;
  376. width:100px;
  377. }
  378.  
  379. select option {
  380. padding: 5px 8px;
  381. width: 130%;
  382. border: none;
  383. box-shadow: none;
  384. background: transparent;
  385. background-image: none;
  386. -webkit-appearance: none;
  387. }
  388.  
  389. select select:focus {
  390. outline: none;
  391. }
  392. #output{
  393. transition:all .25s;
  394. }
  395. #output p{
  396. margin:0 auto;
  397. width:100%;
  398. font-size:.4em;
  399. line-height:1em;
  400. text-align:left;
  401. }
  402. .blurb{
  403. display:none;
  404. margin:15px;
  405. text-align:left;
  406. border:solid gray 2px;
  407. padding:10px;
  408. }
  409. #output h1 { font-size: 2em; margin: .67em 0;line-height:1em;}
  410. #output h2 { font-size: .8em; margin: .75em 0;line-height:1em;}
  411. #output h3 { font-size: .6em; margin: .83em 0;line-height:1em;}
  412. h4 { margin: 1.12em 0 }
  413. h5 { font-size: .83em; margin: 1.5em 0 }
  414. h6 { font-size: .75em; margin: 1.67em 0 }
  415. #output ul {
  416. list-style-type:circle;
  417. }
  418. #output ul li{
  419. display:list-item;
  420. list-style:circle;
  421. margin:0 auto;
  422. font-size:.4em;
  423. line-height:1em;
  424. text-align:center;
  425. }
  426. #listcont{
  427. width:50%;
  428. margin:0 auto;
  429. }
  430. #mainhead{
  431. font-size:1.5em;
  432. margin-bottom:15px;
  433. }
  434. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement