www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 05-17-2007, 08:43 PM
    Vicboy Vicboy is offline
    Registered User
     
    Join Date: May 2007
    Posts: 2
    Cookies and Drop Down BG Select <-- Help (Code included I guess)

    Hello...

    I have this problem with Cookies and Drop Down BG Select

    When ever I select a background image, it works...

    But if I exit it... The image I selected will not automatically appear...

    Why doesnt the cookies work?

    Things:

    I tried it with IE 7 or Mozila 2.03
    I did not make this script
    This purpose is for offline use...
    Its javascript

    Here is the Script


    Quote:

    <html>
    <head>

    <script type="text/javascript">
    function chkcookie(){
    var grabcookies = document.cookie;
    var pos = grabcookies.indexOf("mthbkg=");
    if (pos !=-1){
    var st= pos+7;
    var en= grabcookies.indexOf(";",st);
    if (en ==-1) en = grabcookies.length;
    var val = grabcookies.substring(st,en);
    document.body.style.background="scroll url(mthImage/"+val+".jpg)";
    }else{
    document.body.style.background="scroll url(1.jpg)";
    document.cookie = "mthbkg=Apr"
    }
    }
    function chg_bkg(x){
    if (x=="1"){document.body.style.background="scroll url(1.jpg)";}
    if (x=="2"){document.body.style.background="scroll url(2.jpg)";}
    if (x=="3"){document.body.style.background="scroll url(3.jpg)";}
    if (x=="4"){document.body.style.background="scroll url(4.jpg)";}
    if (x=="5"){document.body.style.background="scroll url(5.jpg)";}
    if (x=="6"){document.body.style.background="scroll url(6.jpg)";}
    if (x=="7"){document.body.style.background="scroll url(7.jpg)";}
    if (x=="8"){document.body.style.background="scroll url(8.jpg)";}
    if (x=="9"){document.body.style.background="scroll url(9.jpg)";}
    if (x=="10"){document.body.style.background="scroll url(10.jpg)";}
    if (x=="11"){document.body.style.background="scroll url(11.jpg)";}
    if (x=="12"){document.body.style.background="scroll url(12.jpg)";}
    if (x=="13"){document.body.style.background="scroll url(13.jpg)";}
    if (x=="14"){document.body.style.background="scroll url(14.jpg)";}
    if (x=="15"){document.body.style.background="scroll url(15.jpg)";}
    if (x=="16"){document.body.style.background="scroll url(16.png)";}
    if (x=="17"){document.body.style.background="scroll url(17.jpg)";}
    if (x=="18"){document.body.style.background="scroll url(18.jpg)";}
    if (x=="19"){document.body.style.background="scroll url(19.jpg)";}
    if (x=="20"){document.body.style.background="scroll url(20.jpg)";}
    if (x=="21"){document.body.style.background="scroll url(21.jpg)";}
    if (x=="22"){document.body.style.background="scroll url(22.jpg)";}
    if (x=="23"){document.body.style.background="scroll url(23.jpg)";}
    if (x=="24"){document.body.style.background="scroll url(24.jpg)";}
    document.cookie = "mthbkg="+x;
    }
    </script>

    <body onLoad="chkcookie()" >
    <select name="mth" onclick="chg_bkg(value)">
    <option value="1">Reborn</option>
    <option value="2">Apocally</option>
    <option value="3">The Discovered</option>
    <option value="4">Join the army</option>
    <option value="5">Aurostile</option>
    <option value="6">Bubble Surf</option>
    <option value="7">World's End</option>
    <option value="8">Classical Noting</option>
    <option value="9">Earth's Moan</option>
    <option value="10">Darkest Jungle</option>
    <option value="11">Sparked Darkness</option>
    <option value="12">Tree Spark</option>
    <option value="13">Bottomless Pit</option>
    <option value="14">Homers got ya</option>
    <option value="15">DNA String</option>
    <option value="16">Earth's End</option>
    <option value="17">Blue Blossoms</option>
    <option value="18">African Shine</option>
    <option value="19">Green Nightmare</option>
    <option value="20">Atomic Sun</option>
    <option value="21">Blue Elevator</option>
    <option value="22">Music's Boom</option>
    <option value="23">War Of The Worlds</option>
    <option value="24">Unsuspected Doom</option>
    </select>
    </body>
    NOTE: That script is with some other scripts
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 01:38 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.