gray8110 Posted September 24, 2008 Share Posted September 24, 2008 I have a press release document that is provided for me every month with a schedule of events for the month. I really don't touch the release, it just goes on the web after running a little script to add the appropriate HTML tags - it's currently a static HTML page with no intellgence at all. Currently, it displays a whole month of events but this isn't ideal because it forces users to scroll to the next event. I'd like to add some functionality that would hide the content that is prior to today's date. Here's an example of the HTML and how I'd like it to be afterwards: before <div id="092208">Content... don't want to show this because this is old</div> <div id="092408">Want to show this because it is today or in the future</div> <div id="092508">Want to show this because it is today or in the future</div> after <div id="092408">Want to show this because it is today or in the future</div> <div id="092508">Want to show this because it is today or in the future</div> I know my way around conditionals well enough to write a function that will determine if the ID is prior to today's date, but I don't know how to hide those divs. I can think of a few ways to do this with javascript, but a significant number of my users are at work PCs that have JS disabled by default. Any ideas on how to do this - or if you have a more elegant way to approach it, feel free to speak up. Quote Link to comment https://forums.phpfreaks.com/topic/125570-hiding-elements-by-id/ Share on other sites More sharing options...
Zane Posted September 24, 2008 Share Posted September 24, 2008 will hide a DIV Quote Link to comment https://forums.phpfreaks.com/topic/125570-hiding-elements-by-id/#findComment-649239 Share on other sites More sharing options...
gray8110 Posted September 24, 2008 Author Share Posted September 24, 2008 That's a solution I wouldn't have thought of (too simple), but I still need PHP to conditionally add the inline style to the appropriate divs... Lets see if I can mangle my way through that. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/125570-hiding-elements-by-id/#findComment-649242 Share on other sites More sharing options...
Zane Posted September 24, 2008 Share Posted September 24, 2008 use Javascript to do it function hideDIV(theID) { divInQuestion = getElementById(theID).style = "display: none"; return true; } hideDIV('092408'); Quote Link to comment https://forums.phpfreaks.com/topic/125570-hiding-elements-by-id/#findComment-649243 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.