SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2004
    No Where
    0 Post(s)
    0 Thread(s)

    I really need help with this please

    I'm desperate...I've searched google over and over again typing different queries and I've gone on many forums such as this one and I cannot find an answer to my question...

    I have a website with an english and a german part (english is my site and the german part is a friend webmaster's site...)

    I hate splash screens and I want it to appear once. I want the user to choose the language and then he will be automatically redirected to his choice instead of having to use the splash screen again.

    I know nothing about cookies nor Java programming...only HTML

    Does anyone have a pre-made script or something to help me?

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Alabama, USA
    0 Post(s)
    0 Thread(s)
    Hi Prosis, Welcome to SitePoint Forums!

    This was a quickie - and I haven't tested it - but maybe it will be helpful.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta name='author' content='Author' />
    <meta name='description' content='Description' />
    <meta name='keywords' content='Keywords' />
    <link rel='stylesheet' type='text/css' href=''>
    <style type='text/css'>
    <script type='text/javascript' src=''></script>
    <script type='text/javascript'>
    window.onload = function()
      var lang = xGetCookie('language');
    function setLanguage(lang)
      xSetCookie('language', lang);
    function redirect(lang)
      var url;
      if (lang == 'german') {
        url = 'myGermanPage.html';
      else if (lang == 'english') {
        url = 'myEnglishPage.html';
      else {
      if (location.replace) {
      else {
        location.href = url;
    // X, DHTML Library, Licensed LGPL
    // cookie implementations based on code from Netscape Javascript Guide
    function xSetCookie(name, value, expire, path) {
      document.cookie = name + "=" + escape(value) + ((!expire) ? "" : ("; expires=" + expire.toGMTString())) + "; path=/";
    function xGetCookie(name) {
      var value=null, search=name+"=";
      if (document.cookie.length > 0) {
        var offset = document.cookie.indexOf(search);
        if (offset != -1) {
          offset += search.length;
          var end = document.cookie.indexOf(";", offset);
          if (end == -1) end = document.cookie.length;
          value = unescape(document.cookie.substring(offset, end));
      return value;
    <p>Select your language:
      <a href='myEnglishPage.html' onclick="setLanguage('english')">English</a>,
      <a href='myGermanPage.html' onclick="setLanguage('german')">Deutsche</a>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts