Preserving link and default state using cookies

Hello,
I am not sure where to post this with the re-design of this forum; it's been a while so please forgive me if this is in the wrong g place.
I have a very basic link wrapped in a UL tag.
I am using JQuery to give the links a color when they are clicked by performing an add/remove class function, the link state is than preserved by cookies so if a user returns to a page; it shows what tab they were viewing.
The problem is; this is a single page and I want to set a default link or tab; say the first one. I do not know how to do this.
This is what I am looking to accomplished:
A user visits the page and the first link is colored red (default)
If the user clicks on another link that link becomes active and the first link looses it's default status
When the user returns the first link is nolonger the default, it is whatever link the user selected when first visited; that's because that link was rememberd using cookies.
The first link will ONLY maintain the default state if the user deletes his cookies or visits the page for the first time.
Here is a peice of JQuery I have used to maintain the selected state:
$(document).ready(function() {
    var idActive = $.cookie('cookieActive');
    if (idActive) {
        $('#'+idActive).addClass('activeLink');
    $('ul li a').click(function() {
        var id = $(this).attr('id');
        $("ul li a").removeClass("activeLink");
        $(this).addClass("activeLink");
        $.cookie('cookieActive', id);
        $.cookie('cookieActive', id, { expires: 10000});

Good day Mr. Powers!!
Thank you as always; you are so helpful.
I am editing this post because I did not get this to work due to my error with applying the ID.
It is working now and thank you so much!
By the way any more PHP books in the works?
DR
Code is now working with selecting default tab.

Similar Messages

  • CS3 - How can I preserve Links and Hyperlinks in my INDB?

    I am still pretty new to ID, so please speak slowly :)
    My problem - I create an INDB that consists of several indd chapters. The chapters include numerous Links (to PNG & PSD images) and Hyperlinks both to Text anchors to other chapters within the INDB, as well as to URLs. I have all items saved on my local HD. Once complete, I do "Package for Print", check the Preflight report to make sure all is OK (it is) and then save the new INDB folder in a new location on my local HD. This all seems to work just fine, BUT if I move this packaged INDB folder (such as to a backup drive, or give to another worker that copies it to their HD), upon opening the INDB file, some links and Hyperlinks are broken.
    It seems that these broken Links and Hyperlinks are still pointing to the original locations on my HD. But obviously not all are, since most links/hyperlinks DO work fine. The Hyperlinks to Text anchors within other indd chapters seem to typically break. Is there a way to force these to reference the packaged assets within the INDB folder? Seems ID would be smart enough to look there itself!
    Also, I was creating some Hyperlinks as "cross referenced" - that is, I created a URL Hyperlink Destination in Chapter 1 indd and then created Hyperlinks pointing to it from other chapter indd in the book. I have learned that these ALWAYS break in the above scenario, so I started creating the URL destination within the same chapter indd and pointing to it there rather than across chapters. But this is just more work to keep re-creating the same URL destination in every indd!
    I'll keep running into these problems since I need to share my finished INDB with other CS3 users. I also would like to be able to do a Save As of the INDB when creating a revised, newer version, but I see this also results in the new INDB links/hyperlinks still pointing to the original INDB's assets! Any way to make the Save As update the Links/Hyperlinks in the new INDB?
    Thanks greatly for any insight. I can find no help in the Help on these issues!

    The title of the post is this
    How can I preserve row and column addresses on multiple cells at once in Numbers?
    I restated the Question as follows
    Can "Preserve Row" an / or "Preserve Column" be set on multiple cells at the same time.
    In both cases it is not asked if multiple cells can be set to....
    That is a given.
    Step back a second...  It is like selecting multiple cells and setting the text color of the currently selected cells to red. This can be done. More than one cell at a time modified because they are currently selected.
    Whats is being asked is:  if more than one cell is selected at the same time can the settings "Preserve Row" an / or "Preserve Column" be applied. No table I put up will help with that question.
    YES or NO
    If YES how?

  • YouTube and others not using Cookies

    Hello, I am trying to get cookies working properly. All the boxes in Preferences>Privacy are ticked including "Accept cookies from sites" and Accept third-party cookies". There are no sites at all in "Exceptions"
    I visited a self-hosted Wordpress blog earlier that I've never visited before and tried to post a long comment. When I pressed submit I was told it would only work if I accepted cookies. A look at the cookies revealed the site did leave a cookie. I still couldn't post the comment though.
    With YouTube, several times a day, every day, it says it looks I am in the UK. I say yes and it it is supposed to save that, but several times a day I get asked the same question. I also can't stay logged into other Google owned sites. I think the same goes for eBay.
    The box "Clear history when Firefox closes" is ticked, could that be the problem?
    Thank you for your help.

         I just figured it out, i was looking on an ipad forum ap thing and someone had said change the dns, and someone put down 8.8.8.8 and i tried it and now it works fine, so very happy right now

  • Net Due date differs in  FBLl5N  and print statement used

    HI all,
    we are using customer statement of accounts, which shows the document due date. Using payment terms 30 days and  Due date is calculated  from document date, but our statement differs in calculation of due date.
    eg/:
    Doc.date        DocDue date 
    31.07.2006      29.08.2006
    23.08.2006      14.08.2006 and in the standard report FBL5n which shows as below
    31.07.08        30.08.2006
    23.08.2006      15.08.2006
    Looking for ealier reply
    Best Regards
    stefen & raj

    Hi,
    30.08.06 is correct - compare fm DETERMINE_DUE_DATE
    and link:  Re: FI-ABAP : how to calculate payment date using a module function ?
    A.
    Message was edited by: Andreas Mann

  • How to create links and how to use that links to go to other pages?

    my question is....how to create links...i mean by using make link option.....when we do right click on a word,etc in the design view.....and my other question is.....how to use that links to go to other pages.....i mean when i click on a link...it takes me to another web page.....

    Please do not post the same subject to more than one forum.

  • Profit and Loss statement Business Area Wise

    Dear Friends,
    i am trying to create Financial Statement ( Profit and loss statement) using )FIGL_V11 Virtual cube.
    its working fine  and no problem.
    We have 8 Business Areas. and i would like to create Profit and Loss statement Business Area wise.
    How can i achive this requirement.
    Any help will be higly Appricated.
    Regards.
    Malik

    Dear i check Profit Center Info Object but there are only these attributes.
    Source System
    Object Currency for CO Object
    Person Responsible
    Source system ID
    Person Responsible
    Department (Profit Center)
    Hierarchy Area (Profit Center)
    Segment for Segmental Reporting
    I am unable to fine Bussiness Area in the attribut of  info Object 0PROFIT_CTR .
    Regards
    Malik

  • Link and Backlink attributes in OID??? Retrieving the groups of a user???

    Hello,
    is there anything in Oracle Internet Directory that corresponds to what in Microsoft Active Directory are links and backlinks???
    Having placed a user inside a set of groups, how can I efficiently retrieve the list of groups the user belongs to??? In AD links and backlinks are used for this: when I place a user inside a group the member attribute on the group is populated with the DN of the user and AD places the DN of the group inside the memberOf backlink attribute of the user. This allows for efficiently retrieving the list of groups the user belongs to. How does all this work in OID???
    Thanks.
    Bob

    Hi prigas
    Yes, I also thought this Q was rather rough.. Here's a copy & paste of the question, ANY help whatsoever would be appreciated - even if you have hints as to methods,etc I should consider...
    We are currently studying recursion...if hat helps at all!
    Any help at all - please?!?!? Thanks a lot!
    Actual Q:
    ~~~~~~~~~~~~~~~~~
    Write a program to compute a simple 3x3 spreadsheet containing both integers and strings. Firstly, there would be input from the user (in rows - see example below), then perform calculations on the user input as outlined below ...and finally, output the computed spreadsheet as a matrix.
    Your program only needs to cater for addition/subtraction formula. Your columns (numbered A,B,C) and rows (numbered 1,2,3) will never be more than a single character and cell values/formulae have no spaces or errors. Examples of formulae are:
    =A1, =A1+B1, =A1+A2-A3, =B3-C3
    Sample Input
    1 2 3 4 5 6 =A1+A2 =B1+B2 =C1+C2
    Sample Output
    1 2 3
    4 5 6
    5 7 9
    Sample Input
    Jack 12 23 Jill 45 67 Total =B1+B2 =C1+C2
    Sample Output
    Jack 12 23
    Jill 45 67
    Total 57 90
    ~~~~~~~~~~~~

  • CSS setup for "a:link" and "a:visited"

    In Dreamweaver CST,'m setting up "a:link" and "a: visited" using CSS and doing it by the book, but when I save my website to the browser the effects don't come out. Either the colors are inverted and/or the "visited link" does not stay after "mouse out." I've followed 3 DW books on this and I still can't get it to work correctly. What am I missing?

    a:visited changes the color of links after you visit their pages on the website. It runs off the browser history.
    Are you sure you're not trying to do a:hover, which would change color while hovering the mouse over the link?
    In your css, you need to make sure your link pseudo classes are set in a specific order...
    a (or a:link)
    a:visited
    a:hover
    a:active
    If they're out of order, weird things can happen.
    Also, make sure you don't have any other a:pseudo classes later in your css that are accidentally overwriting them.

  • Hypertext links are not always preserved from Word to PDF, using Aperçu or Adobe, depending on OS 10 or Lion. Why? This generally works perfectly in Windows. Why are Apple and Adobe unable to correctly handle links when converting from Word to PDF?

    Hypertext links are not always preserved from Word to PDF, using Aperçu or Adobe, depending on OS 10 or Lion. Why? This generally works perfectly in Windows. Why are Apple and Adobe unable to correctly handle links when converting from Word to PDF?
    Depending on the system version, and Office Word version:
    - a pure URL link starting with http or even www sometimes works in PDF, either produced by Aperçu or Adobe, sometimes does not work;
    - other kind of links where the text under display is not a URL, never work!
    I like everything with Apple computers and software, except PDF generation. Output files are usually bigger in size, and no better quality, than under Windows. Furthermore, it is weird that something as common as hyperlinks does not work correctly!
    I related this question with Mac OS X Snow Leopard, but the problem is still there with Mac OS Lion.
    This problem seems to have been around for years, without any proper solution from Apple and/or Adobe! To me, this is very embarrassing!

    Greetings NoNameGiven,
    If I understand the problem correctly (I’m not sure I do) you would prefer ‘iii’ to be read as “eye eye eye” rather than “three”? The alt text property is the only way that I know of to make this happen. Hope this helps.
    a ‘C’ student

  • When clicking on an Email link it defaults to Internet Explorer browsing and I want it to use the Firefox browser

    An email will have a "Click here" link and when I click it goes to a internet explorer browsing, not a firefox browser

    That is is always a problem when you are using multiple profiles and Firefox isn't running.
    It might work if no profile is selected (i.e. marked as Default=1 in profiles.ini).<br />
    You can use desktop shortcut that open with a specific profile (-P "profile").<br />
    There is also a setting in the Profile Manager (Don't ask at startup).

  • When trying to get onto my email, the following statement comes uip: "We are sorry, but you will need to enable cookies and Javascript to use your Username with this site. I click "here" but nothing happens. How do I enable cookies amd Javascript?

    Trying to get t my email, this comes up: We are sorry, but you will need to enable cookies and Javascript to use your Username with this site.
    How do I do this?
    George Szanto<br />
    [email protected]

    see similar question answered at https://support.mozilla.com/questions/836913
    To be notified of updates to a question whether it is your problem or not simply click on the "Get email notifications" and follow directed choice. Only the original poster can mark as solved, so there should be a slight difference in choice as an original poster and where you latch onto another question. The notifications only apply to the specific question where entered.

  • After doing a Google search, I click on a link and go to the searched web page.  When I go back to the Google page using the back button the links I originally clicked on no longer show as "greyed out".  Any idea what is going on with the browser?

    After doing a Google search, I click on a link and go to the searched web page.  When I go back to the Google page using the back button the links I originally clicked on no longer show as "greyed out".  Any idea what is going on with the browser?

    Type '''about:config''' in the Location (address) bar and press the "Enter" key. When you see a warning, click '''I'll be careful, I promise!''' button.
    * Preferences that have been modified are shown as '''bold (user set)'''.
    * Preferences can be '''Reset to the default''' or changed via the right-click context menu.
    -> In the '''Filter bar''', type '''browser.sessionhistory.max_entries'''
    * Right click the preference '''browser.sessionhistory.max_entries''' and click '''Modify'''
    * Change value from 0 to whatever you want over 0 (Default value is 50)
    * click OK
    -> Close the '''about:config''' tab and then Restart Firefox.
    See this post:
    * https://support.mozilla.com/en-US/questions/860894#answer-229574
    Check and tell if its working.

  • Using cookies and JavaScript to create a page to page timer.

    I have long wanted to be able to measure the time it takes to get from one page to another.  While reading in my JavaScript reference the other day, I came across cookies.  I've long known about cookies but have never used them.  The thing that looked attractive was that you can access cookies from both JavaScript and CF.
    So I put together the procedures to store the "start time" (startTimeP8D) for the transition and activated it on the onUnload event of a 1stpage.  After a few rewrites I got it working.   Here is the JavaScript to do that: it consists of two functions: doTimer which is the input section and setCookie, which writes to the cookie.  Not the two numbered alert statements.
    doTimer - results for "start" from the doTimer function called from page 1 when it unloads. (See doTimer below)
         Please note that the two startTime8D values are the same immediately after they are stored.
    On the 2nd page in the sequence, I run the corresponding code to determine the "end time", compute the delta and write it out to the page.  It didn't all run on the first try, but it now seems to be running without a crash, which can be misleading.
          second set of outputs from page 2:    
         Please not that while the endTimeP8D match, the startTimeP8D value no longer matches the previously stored value. 
    There is one major hitch in the get along which has me stymied:  As you can see, when you compare the startTimeP8 in the setCookie – results above and the "startTimeP8" in the doTimer results below the startTimeP8 is not the value that I wrote to the cookie @ unload of page 1.  I have checked and checked and do now see anywhere that the startTimeP8D value is being overwritten.  Based upon my limited experience with JavaScript cookies, it seems to me that you get an entry for each time you set the cookie.  So I would expect to see to startTimeP8D entry for each setCookie event, not a different value.
         The result of the failed computation is shown on the bottom of the page.  As you can see, the Total Elapsed Time is negative, which is never a good sign.  The other time shown, Page build time, is the run time from the server.  The whole purpose is to be able to show folks that the reason the code might be show is because of their overloaded network and not our code.  We had one client whose had users running on 56k modems.  It was so slow their VPN software was timing out!!!  Still the had the never to blame us!!!
    I am using SQLServer 2005, CF8, IE8 on W7. 
    I'm not married to this way of doing this so if anyone has a better/easier way of doing a "page to page timer", I'm up for it.  I'd prefer to fix this one since I've been working on it for the past 3 days.
    Thanks in advcance for your help.
    Len, PHRED SE

    Here it is with no JQuery or console logging calls using cookie utility functions found here:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
           "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
         <title>Test JavaScript Page Load Timer</title>
         <script>
              window.onload = function(){
                   var previousPageUnload = getCookie('unloadTime');
                   if(previousPageUnload){
                        var d = new Date();
                        var loadTime = d.getTime() - previousPageUnload;
                        alert(loadTime + 'ms');
              window.onunload = function(){
                   var d = new Date();
                     setCookie('unloadTime',d.getTime());
              function setCookie(c_name,value,expiredays) {
                   var exdate=new Date();
                   exdate.setDate(exdate.getDate()+expiredays);
                   document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
              function getCookie(c_name) {
                   if (document.cookie.length>0) {
                     c_start=document.cookie.indexOf(c_name + "=");
                     if (c_start!=-1)
                       c_start=c_start + c_name.length+1;
                       c_end=document.cookie.indexOf(";",c_start);
                       if (c_end==-1) c_end=document.cookie.length;
                       return unescape(document.cookie.substring(c_start,c_end));
                   return null;
         </script>
    </head>
    <body>
         <h1>Test JavaScript Page Load Timer</h1>
    </body>
    </html>
    Note that overwriting global window events like this is not a good idea, which is why I used JQuery in my earlier example. I strongly suggest you look at JQuery or one of the other JS libraries (YUI, etc.) to help with event handling. I'll leave it at that as this is getting into JavaScript development, not really on topic for a ColdFusion forum.

  • Converting a delete statement using VPD policies and context

    Hello,
    I'm trying to convert a delete statement in a update statement using VPD policies and context.
    +/* Supose the user 'user1' already exists. This is an application user */+
    conn user1/pwd
    create table user1.test_a (
    id                number(4),
    description       varchar2(100),
    deleted           number(1)
    +);+
    alter table user1.test_a add constraint test_a_pk primary key (id);
    insert into user1.test_a (1, 'abc', 0);
    insert into user1.test_a (2, 'def', 0);
    commit;
    I'd like to convert each physical deletion into a logical deletion: statements like "delete from user1.test_a where id = 1" must be converted into "update user1.test_a set deleted = 1 where id = 1".
    I've found the following way: I will create a policy to avoid physical deletion. Additionally, the policy function should update the deletion flag too.
    conn user1/pwd
    +/* Create context package */+
    create or replace package user1.pkg_security_context is
    procedure p_set_ctx(
    i_test_a_id      in   user1.test_a.id   %type
    +);+
    end;
    +/+
    create or replace package body user1.pkg_security_context is
    procedure p_set_ctx (
    i_test_a_id      in   user1.test_a.id   %type
    +) is+
    begin
    dbms_session.set_context( 'user1_ctx', 'test_a_id', i_test_a_id );
    end;
    end;
    +/+
    show errors
    +/* Create trigger to set the context before deletion */+
    create or replace trigger user1.test_a_bef_trg
    before delete on user1.test_a
    for each row
    declare
    pragma autonomous_transaction;
    begin
    -- only commits the preceding update, not the delete that fired the trigger.
    commit;
    user1.pkg_security_context.p_set_ctx( :old.id );
    end;
    +/+
    show errors
    create context user1_ctx using user1.pkg_security_context;
    +/* Policy function */+
    create or replace function user1.f_policy_chk_dels (
    object_schema in   varchar2,
    object_name   in   varchar2
    +) return varchar2+
    is
    out_string                 varchar2(400)   default '1=2 ';
    +/*+
    * out_string is the return value.
    *  - 'WHERE 1=2' means 'nothing to access'
    begin
    if ( loc_logged_usr_authorized > 0 ) then
    +/*+
    * Set the flag deleted to 1
    update user1.test_a set deleted = 1 where id = sys_context( 'user1_ctx', 'test_a_id' );
    out_string := out_string || 'or 1=1 ';
    end if;
    return out_string;
    end;
    +/+
    show errors
    +/*+
    * Create policy
    begin
    dbms_rls.add_policy(
    object_schema   => 'user1'                   ,
    object_name     => 'test_a'                  ,
    policy_name     => 'policy_chk_dels'         ,
    function_schema => 'user1'                   , -- function schema
    policy_function => 'f_policy_chk_dels'       , -- policy function
    statement_types => 'DELETE'
    +);+
    end;
    +/+
    When I try to delete a record of the table test_a:
    conn user1/pwd
    SQL> delete from ilogdia.oplsimulaciones sim       where sim.id = 9999;
    +0 rows deleted+
    No rows has been deleted, but the update stmt does not work. That means, the "deleted" flag has not been updated.
    Any ideas?
    Thank you in advance.
    Marco A. Serrano
    Edited by: albrotar on Oct 15, 2012 8:42 AM
    Edited by: albrotar on Oct 15, 2012 8:42 AM
    Edited by: albrotar on Oct 15, 2012 8:43 AM

    The policy function is applied once per statement execution. The policy function executes first and the UPDATE statement, presumably, updates no rows because the context is not yet populated. The row-level populates the context (I'm assuming that your session can even see context values populated by an autonomous transaction-- I would guess it could but I'd have to test that) after the UPDATE statement is already complete. The COMMIT in the row-level trigger is also pointless-- it only applies to changes made by the current autonomous transaction, of which there are none-- it cannot apply to changes made in other autonomous transactions. Declaring the row-level trigger to use autonomous transactions doesn't seem to accomplish anything other than to open the question of whether the values set in the context by the autonomous transaction are visible in the caller's transaction.
    Even if this, somehow, did work, using autonomous transactions would be a very bad idea since Oracle is free to roll-back a partially executed statement (and the work done by its triggers) and re-execute it. Oracle does that with some regularity to maintain write consistency.
    Justin

  • After I click on a link and come back the link is not a differet color any more so I can't tell which links I have already used.

    I recently had to get a new hard drive and reinstall Firefox. Now when ever I click on an link to look at something and then return to the previous page (like in Craigs list or something) the link is not a different color like it always has been so I can tell which links I have already used, why?

    * Make sure that the History is set to at least 1 day: Tools > Options > Privacy > History: "Remember visited pages for at least"
    * Make sure that you do not run Firefox in Private Browsing mode (Tools > Stop Private Browsing is grayed, see [[Private Browsing]])
    * To see History and Cookie settings in Tools > Options > Privacy, choose the setting "Firefox will: Use custom settings for history"
    You can look at these prefs on the about:config page to make sure that you keep history.
    *http://kb.mozillazine.org/browser.history_expire_days (180) (also affects saved form data)
    *http://kb.mozillazine.org/browser.history_expire_days_min (90)

Maybe you are looking for

  • Mac mini and the old mac iBook clamshell

    Does anyone know if the old iBook clamshell can be used as the monitor and keyboard with the Mac mini? I've got one and I'd like to be able to use it. What about the the old iMac blueberry bubbles/OS 9.2. Can I use this with a Mac mini as the monitor

  • DPM 2012 R2 backup of Workgroup computer error

    Hi, we have a Workgroup server that we had successfully backed up to a DPM 2012 Server. Since then we have built 2 brand new DPM 2012 R2 servers. I have uninstalled the DPM 2012 agent from the Workgroup computer and have installed the new DPM 2012 R2

  • MacBook Air 6,1 Bootloader

    I have a Macbook Air 2013, 6,1. I have been trying to use rEFInd as the bootloader, but I can't seem to make it work. Here's how I have my partition's set up: sda1 EFI (vfat) sda2 Mac OS X (HFS+) sda3 Mac OS Recovery sda4 / (ext4) sda5 swap I have sd

  • REG: File Adapter

    Hi All,         I have a scenario where i need to pick 2 files from 2 different folders and process them in a particular sequence. Can anyone suggest me a method how this can be achieved. Thanks, Siva.

  • Address book has a secret life? Double entries.

    I notice that quite a few of my records now have double entries - not for ALL of the info, but like just for mobile phone numbers or work numbers. And not all records have these. Strange. Anyone else seeing this?