Results 1 to 4 of 4

Thread: Help me to develop this code

  1. #1
    Join Date
    Sep 2016
    Posts
    8
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Help me to develop this code

    I have css code that placed above </body>
    I want this, to show on my blog only 12 hour per day (or I can set the time), also with cookie

    Code:
    <style type='text/css'>
    #trblack{padding-left:240px;filter:alpha(opacity=60);opacity:.0;position:fixed;_position:absolute;top:20px;left:0;z-index:10;clip:inherit;_top:expression(document.documentElement.scrollTop+document.documentElement.clientHeight-this.clientHeight);_left:expression(document.documentElement.scrollLeft+document.documentElement.clientWidth - offsetWidth)}
    #samping {padding-left:280px;}
    </style>
    Expert please help
    Last edited by jscheuer1; 10-07-2016 at 04:39 PM. Reason: format code

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You cannot set or evaluate time or a cookie with css. Javascript or some sort of server side code would be workable. In terms of reliability, server side code is best (results seen by all), next comes javascript (results seen only by those with javascript enabled), next cookie (though a cookie can be set and evaluated server side as well as with javascript, people can refuse, delete, or modify them on their own). What would the cookie do? Setting the time of day in either javascript or server side code would be easier and more reliable.

    Depending upon how mission critical this is, I would go for javascript. On a blog, that's usually available while server side code often is not an option. Also, I get the feeling you want to do this as a sort of daylight/night time sort of thing, have things darker at night - is that it? If so, javascript would be fine, because the few people without it would just see the normal page. And with javascript it's easy to get the user's time, which might make more sense. But if you want the time to be relative to a specific location that can be more or less worked out as well. On the server side it's difficult to get the user's time.

    What's the purpose for this? Is it like I guessed, to give a different look at night?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2016
    Posts
    8
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    You right, can you convert this code to javascript

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, I see it's already using javascript in an indirect way - the IE 9 and less proprietary 'expression' css syntax relies upon a no longer used by any browser technique that used javascript to calculate css values on the fly. It was very effective in it's time, but is now discontinued. What browser(s) are you testing in? What browser(s) are you targeting? I would recommend forgetting about IE 9 and less, and using modern standards. But if there's some reason that's not workable for you, let me know,
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. develop multi-language site
    By madu in forum PHP
    Replies: 2
    Last Post: 11-25-2010, 10:51 PM
  2. develop multi-language site
    By madu in forum JavaScript
    Replies: 2
    Last Post: 11-23-2010, 01:22 PM
  3. i want to develop in javascript same as....
    By asifbhura in forum JavaScript
    Replies: 1
    Last Post: 01-31-2010, 12:03 AM
  4. How to develop a javascript class
    By veerreddy in forum JavaScript
    Replies: 2
    Last Post: 09-01-2008, 11:26 PM
  5. Replies: 1
    Last Post: 08-12-2006, 01:28 PM

Bookmarks

Posting Permissions

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