www.webdeveloper.com
Results 1 to 2 of 2

Thread: Javascript strange error

  1. #1
    Join Date
    Jun 2013
    Posts
    20

    Javascript strange error

    hi!
    i'm pretty new to web programming and programming in general.
    i want to make a web page with various languages (english, italian, croatian...etc)
    i wrote the html for it but i encountered a problem.

    i want to make the site remember the language a visitor has set the last time he visited my webpage in a cookie.
    and every time before the parsing of the page i want my javascript file to check if the language cookie is set, and if not, to create it and set its value to "english".
    i used jquery and jquery cookie plugin (they are regular included in index.html in the <head><script> tag but the code seems to do nothing!
    the strange thing is that in the javascript console of google crome every row of code seems to work correctly but put all togheter they are useless!
    here is my code!

    THANK YOU!

    $(window).load(function(){

    var language_cookie = $.cookie('Languge');
    if (language_cookie == null)
    $.cookie("Language", "ENG", {expires: 365})});


    $(document).load(function(){
    var language_cookie1 = $.cookie('Languge');

    if (language_cookie1 == "ENG")
    $("#table_select_language th").html("Select your language");

    });

  2. #2
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Code:
    var language_cookie = $.cookie('Languge');
        if (language_cookie == null)
            $.cookie("Language", "ENG", {expires: 365})});
    It''s a language problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles