♥Gyakutsuki Posted March 19, 2012 Share Posted March 19, 2012 Heelo, I try ti insert in my website a pop up country. When the customer arrive in my website, a pop up appear and the customer must choose if it want go in USA store, french store, ou canadian strore for example. My pb is the cookie, When i click on my webpage store, the pop up appear always or, this pop up must appear only one time, when the customer arrive on my website. there the code Do you have an idea with the cookie ? I think the pb is here. Thanks Regards, <script type="text/javascript"> $(function() { $("#modal_country_selector").dialog({ modal: true, draggable: false, stack: false, zIndex: 15000, width: 560, height: 400 }); }); function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else { var expires = ""; } document.cookie = name + "=" + value + expires + "; path=/"; } function selectLanguageData(lang, country) { var currentLanguage = 'CA'; if (lang == currentLanguage) { createCookie('country_bind', country, 10); $("#modal_country_selector").dialog("close"); $("#modal_country_selector").dialog("destroy"); } else { if (country == 'USA') { //location.href = '/boutique/index.php?language=en'; return true; } else { if (lang == 'FR') { return true; //location.href = '/boutique/index.php?language=fr'; } else { return true; //location.href = '/boutique/'; } } } return false; } </script> <style> .popup_countries { background: url("/logo.jpg") no-repeat scroll 0 0 transparent; border: 1px solid #000000; font-family: "Trebuchet MS",Arial,Helvetica,sans-serif; height: 360px; position: relative; text-align: left; text-transform: uppercase; width: 540px; } .popup_countries .text_mark1 { color: #646464; font-size: 12px; height: 33px; left: 0; line-height: 33px; overflow: hidden; position: absolute; text-align: center; top: 82px; width: 269px; } .popup_countries .text_mark2 { color: #646464; font-size: 12px; height: 33px; line-height: 33px; overflow: hidden; position: absolute; right: 0; text-align: center; top: 82px; width: 270px; } .popup_countries .lng_sel { color: #000000; font-size: 14px; font-weight: bold; } .popup_countries .lng_sel a { color: #000000; text-decoration: none; } .popup_countries .lng_sel a:hover { color: #000000; text-decoration: underline; } .popup_countries .lng_sel1 { left: 0; position: absolute; text-align: center; top: 149px; width: 179px; } .popup_countries .lng_sel2 { left: 100px; position: absolute; text-align: center; top: 149px; width: 180px; } .popup_countries .lng_sel3 { left : 200px; position: absolute; right: 0; text-align: center; top: 148px; width: 179px; } .popup_countries .lng_sel4 { left : 300px; position: absolute; right: 0; text-align: center; top: 148px; width: 179px; } </style> <div style="display: block; z-index: 1502; outline: 0px none; position: absolute; height: auto; width: 540px; top: 182px; left: 424px;" class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-resizable" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-modal_country_selector"><div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span class="ui-dialog-title" id="ui-dialog-title-modal_country_selector"> </span><a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button"><span class="ui-icon ui-icon-closethick">close</span></a></div><div style="width: auto; min-height: 0px; height: 360px;" id="modal_country_selector" class="ui-dialog-content ui-widget-content"> <div class="popup_countries"> <div class="text_mark1">CHOISIR VOTRE PAYS ET VOTRE LANGUE</div> <div class="text_mark2">SELECT YOUR COUNTRY AND LANGUAGE</div> <div class="lng_sel lng_sel1"><a onclick=" return selectLanguageData('CA', 'CAN')" href="http://www.site.com/boutique/index.php?language=en"><img width="55" height="33" alt="" src="/boutique/sources/image/icons/icon-canada.gif"/></a><br/><a onclick=" return selectLanguageData('CA', 'CAN')" href="http://www.site.com/boutique/index.php?language=en">English</a></div> <div class="lng_sel lng_sel2"><a onclick=" return selectLanguageData('FR', 'CAN')" href="http://www.site.com/boutique/"><img width="55" height="33" alt="" src="/boutique/sources/image/icons/icon-canada.gif"/></a><br/><a onclick=" return selectLanguageData('FR', 'CAN')" href="http://www.site.com/">Français</a></div> <div class="lng_sel lng_sel3"><a onclick=" return selectLanguageData('CA', 'CAN')" href="http://www.site.com/boutique/index.php?language=en"><img width="55" height="33" alt="" src="/boutique/sources/image/icons/icon-usa.gif"/></a><br/><a onclick=" return selectLanguageData('CA', 'CAN')" href="http://www.site.com/boutique/index.php?language=en">English</a></div> <div class="lng_sel lng_sel4"><a onclick=" return selectLanguageData('FR', 'FR')" href="http://www.site.fr"><img width="55" height="33" alt="" src="/boutique/sources/image/icons/icon-canada.gif"/></a><br/><a onclick=" return selectLanguageData('FR', 'FR')" href="http://www.site.fr/">Français</a></div> </div></div><div class="ui-resizable-handle ui-resizable-n"/><div class="ui-resizable-handle ui-resizable-e"/><div class="ui-resizable-handle ui-resizable-s"/><div class="ui-resizable-handle ui-resizable-w"/><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se" style="z-index: 1001;"/><div class="ui-resizable-handle ui-resizable-sw" style="z-index: 1002;"/><div class="ui-resizable-handle ui-resizable-ne" style="z-index: 1003;"/><div class="ui-resizable-handle ui-resizable-nw" style="z-index: 1004;"/></div><div class="ui-widget-overlay" style="width: 1388px; height: 1005px; z-index: 1501;"/> Quote Regards ----------------------------------------- Loïc Contact me by skype for business Contact me @gyakutsuki for an answer on the forum Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.