JavaScript Source Code 3000: Page Details: New Links
New Links
Displaying links as new for a few weeks after adding them is great. But, adding, removing, and updating that "New" icon for each link is pointless! Let JavaScript do your work for you! Just add a small code (less than 40 characters) next to each link with the date you want it to expire, and it will automatically display the "New" icon until the expiration date. What a time-saver!
checknew("6/01/2000") Shown as "New" until 6/01/2000
checknew("12/01/2000") Shown as "New" until 12/01/2000
checknew("6/01/2001") Shown as "New" until 6/01/2001
checknew("12/01/2001") Shown as "New" until 12/01/2001
JavaScript Source Code 3000: Page Details: New Links
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!
<!-- TWO STEPS TO INSTALL NEW LINKS:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Nicolas -->
<!-- Web Site: http://www.javascript-page.com -->
<! >
<! >
<!-- Begin
function checknew(date) {
var pic = "http://www.your-web-site-address-here.com/where-you-put-it/new.gif";
expdate = new Date(date);
curdate = new Date();
if (expdate.getTime() > curdate.getTime())
document.write("<img src=" + pic + ">");
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<script> checknew("6/01/2000") </script>Shown as "New" until 6/01/2000<br>
<script> checknew("12/01/2000") </script>Shown as "New" until 12/01/2000<br>
<script> checknew("6/01/2001") </script>Shown as "New" until 6/01/2001<br>
<script> checknew("12/01/2001") </script>Shown as "New" until 12/01/2001<br>
<!-- Each news item should have an expiration check
with this: <script> checknew("6/01/2000") </script> -->
<!-- Also remember to save the new.gif image to your server.
Right click the link below and select "Save Image As..."
../img/new-links/new.gif -->
<!-- Script Size: 1.18 KB -->
Wyszukiwarka
Podobne podstrony:
links newnew 4Twilight Saga New Moon 2009 CAM XviD POISONlinks (2)BESM New Attributes & Defects 2 0WentyleSmayNP110 newnew?atures 1 1conceive new project?5322C0Zagrożenie Współczesnego Człowieka Ruch New AgeWentyleSmayPJAU newnew pageSuk Fanfare Towards a New LifeMadonna A New ArgentinaNew folder wejściówka 4więcej podobnych podstron