javascript - Use a language dropdown selector to use a GET function to change language -
hi i'm trying use dropdown selector change language of wordpress website i'm designing, used simple setlanguage(); function did in php selected option on html code won't change url affect site. there solution can use that?
what i've tried
i've tried add onchange="window.location.href=this.value"
html i've tried add javascrip
<script type="text/javascript"> var urlmenu = document.getelementbyid( 'menu1' ); urlmenu.onchange = function() { window.open( this.options[ this.selectedindex ].value ); }; </script>
this dropdown html i've been [using][1] http://www.ixtendo.com/polyglot-language-switcher-jquery-plugin/
here [demo][2] http://www.ixtendo.com/demo/polyglot-language-switcher-jquery-plugin-2.2/index.html
the php function i've used change language
<?php function setlanguage() { if (isset($_get['lan'])) { if($_get['lan'] == 'en') { require_once('php/languages/en.php'); }else{ require_once('php/languages/al.php'); } } else{ require_once('php/languages/al.php'); } } setlanguage(); ?>
Comments
Post a Comment