dcsimg
www.webdeveloper.com
Results 1 to 1 of 1

Thread: cookie script help?

  1. #1
    Join Date
    Jul 2007
    Posts
    76

    cookie script help?

    Hi All,

    Wondering if someone can help me finish off coding my script? It works the way I would like it to apart from one small problem which i've hit a brick wall over. i'll explain below.

    i am currently developing this page for my employers: https://bookings.palace-cinema.com/

    on instructions from my employers they want me to remove the small palace cinema link on the page and instead when the page loads have the movie list visible instead.

    currently you will see the movie list if the search by movie or the small palace cinema link is clicked.

    i do have access to "most" files, i say most because under instructions im only to find a solution in the visSelect.aspx file.

    they will not give me access to the code-behind vb file. because if their software is updated in the future any changes i would make to the vb could be overwritten.

    i must say i am pretty much an amateur developer, with little experience dealing with aspx files. I have noticed a big difference in viewing the source in my browser live and editing the source locally.

    as if you do view the source of the page above there is a _doPostBack function but this is not editable locally when i edit the file. which i believe is quite important to what im hoping to achieve.

    i do believe this is because im dealing with aspx files and this function is likely to be kept in the code-behind vb file.

    PROBLEM: so i have developed this cookie script below based around the _doPostBack function, which does load the movie list like i want but unfortunately it does not load any screen times, when you click on your movie it loads the column but no times.

    i think this is because all the links use the _doPostBack function, but in my code i specify the Palace Cinema link only at least i think my code does. so im not sure why the movie times don't show up.


    to see what i mean about movie times on the current page (above) you have to click the cinema link first then of course choose your movie and then you should see the times.

    I am open to other solutions, but I believe i have exhausted my options and this is the closest i have been to completing it. So im hoping its just something missing or i can change in my script.

    Thanks.

    MY CODE:

    <script language="javascript" type="text/javascript">
    <!--

    function richloader(){
    if(rich_get_cookie("richpal") == 0){
    document.cookie = "richpal=1";
    __doPostBack('1001','');
    }

    if(rich_get_cookie("richpal") == 1){
    document.cookie = "richpal=2";
    }

    else{
    delete_cookie ("richpal");
    }
    }

    function delete_cookie ( cookie_name )
    {
    var cookie_date = new Date ( ); // current date & time
    cookie_date.setTime ( cookie_date.getTime() - 1 );
    document.cookie = cookie_name += "=; expires=" +
    cookie_date.toGMTString();
    }

    function rich_get_cookie ( cookie_name )
    {
    var results = document.cookie.match ( '(^|;) ?' + cookie_name +
    '=([^;]*)(;|$)' );

    if ( results )
    return ( unescape ( results[2] ) );
    else
    return 0;
    }

    // -->
    </script>




    Last edited by rbrown; 04-02-2009 at 06:28 PM.

Thread Information

Users Browsing this Thread

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

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