Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:13

Is it possible to get the menu to show a 'new' item?


Poster: Ruth
Dated: Thursday September 11 2003 - 3:16:23 BST

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


Poster: Maz
Dated: Thursday September 11 2003 - 16:54:30 BST

You need a backend built like php, perl, or asp to add menu items.
I wouldn't attempt it myself.

Regards
maz


Poster: Ruth
Dated: Thursday September 11 2003 - 21:22:16 BST

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:

Code:
<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:
<script>
expireat("November 21, 2001")
</script>


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


Poster: Andy
Dated: Thursday September 11 2003 - 22:24:18 BST

I think what you are looking for is something like this


Code:
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


Poster: Ruth
Dated: Friday September 12 2003 - 2:26:26 BST

Thanks Andy. I'll play with it and come back if I can't figure it out. Glad you got the power back. :)

Ruth


Poster: Hergio
Dated: Friday September 12 2003 - 14:58:07 BST

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.

Code:
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="";