I was wondering if there's a code where you can put in a 'new' with a date expiration on it for when a new item in put on a website? I mean to get that to function in the menu. Say I put up a new poem and want the 'poetry' link to show new next to it for 15 days or so. Thanks,
Ruth
Is it possible to get the menu to show a 'new' item?
Maz, I'm not sure what you're saying, and I think I didn't say clearly what I meant, it's not about adding menu items, it's about putting a code that shows it as a new item that then expires at a certain date. Here's a code I found at Dynamic Drive
Description: This is a very practical script that allows you to display a "what's new" image beside new content for a certain amount of time, then disappear automatically when the time expires.
Directions
Step 1: Insert the below into the <head> section of your page:
_________
Step 2: Add the below code alongside the "new" content. By doing so, a "what's new" image will show up until the specified date in function "expireat()":
I've found a couple of other different js codes that are supposed to do that, and I am wondering if it's possible to implement one of them with the menu.
Ruth
Description: This is a very practical script that allows you to display a "what's new" image beside new content for a certain amount of time, then disappear automatically when the time expires.
Directions
Step 1: Insert the below into the <head> section of your page:
Code: Select all
<script>
<!--
/*
"Whats new?" image script-
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free scripts here!
*/
//set the below to the image you wish to use as the "new" image
var imagetag='<img src="wahtever.gif">'
var today=new Date()
function expireat(expiredate){
var expire=new Date(expiredate)
if (today.getTime()<=expire.getTime())
document.write(imagetag)
}
//-->
</script>
Step 2: Add the below code alongside the "new" content. By doing so, a "what's new" image will show up until the specified date in function "expireat()":
Code: Select all
<script>
expireat("November 21, 2001")
</script>
Ruth
I think what you are looking for is something like this
This can go inside the menu definition.
Lots funky stuff like that if you need it
Cheers
Andy
Code: Select all
var expiredate = new Date("September 22, 2003")
var today=new Date()
if(today<=expiredate)aI("text=Menu Item Goes Here");
This can go inside the menu definition.
Lots funky stuff like that if you need it
Cheers
Andy
Yeah Andy, its nice havin ya on the forums again. Welcome back.
To build upon what Andy said, which was display an entire menu item when the dates are right, you could just set an img variable which would be a new image icon.
To build upon what Andy said, which was display an entire menu item when the dates are right, you could just set an img variable which would be a new image icon.
Code: Select all
now = new Date();
newimg = ( now<=new Date("9/25/2003") ) ? "<img src='newimage.gif'>" : "";
aI("text="+newimg+" Menu 1"); newimg="";
newimg = ( now<=new Date("9/23/2003") ) ? "<img src='newimage.gif'>" : "";
aI("text="+newimg+" Menu 2"); newimg="";
Dave Hergert
Software Engineer
"Helping to make the menu better, one at a time."
Software Engineer
"Helping to make the menu better, one at a time."