Solved

load new index by date range in the month

Posted on 1997-03-28
1
153 Views
Last Modified: 2012-06-21
I have four different index pages.  What I would like to do is use JavaScript to load index1 from the 1st to the 7th, index2 8th to 14th, index3 15th to 21st, index4 22nd to 30/31st.  But I want to make sure the viewer is using Netscape, if not then load which ever index is specify.

Thanks in advance...Allen
ps:  Ina Gardner sent me...
0
Comment
Question by:aj032897
1 Comment
 
LVL 3

Accepted Solution

by:
RM032397 earned 200 total points
Comment Utility
Here is some code for testing for browsers
// BROWSER TEST
var NN2 = (navigator.appName == "Netscape" &&
navigator.appVersion.substring(0,1) == 2);
var NN3 = (navigator.appName == "Netscape" &&
navigator.appVersion.substring(0,1) == 3);
var NN4 = (navigator.appName == "Netscape" &&
navigator.appVersion.substring(0,1) == 4);
var IE3 = (navigator.appName == "Microsoft Internet Explorer" &&
navigator.appVersion.substring(0,1) == 3);
var NN34 = (NN3 || NN4)

NN34 is true if browser is Netscape 3 or 4
If 2 was OK you could for example have
var NN = (NN2 || NN3 || NN4)

To get the date you extract it from the date object
var dater = new Date ()
var Today = dater.getDate();

Then you have some careful work to do with "if"
var dater = new Date ()
var Today = dater.getDate();
// Then you have some careful work to do with "if"
var NewLoc = ""
if (Today < 8)                             NewLoc = "index1.html"
if ((Today >=  8 ) && (Today < 15 ))       NewLoc = "index2.html"
if ((Today >= 15 ) && (Today < 22 ))       NewLoc = "index3.html"
if ((Today >= 22 ) && (Today < 32 ))       NewLoc = "index4.html"
this.location.href = NewLoc

The way you put the above fragments of code together, depends upon what you mean by "make sure the viewer is using Netscape, if not then load which ever index is specify"

You could use if (NN) {[code a] }  ; else {[code b]}




0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Angular JS question 24 37
Javascript in a user control not working 17 52
Need sample Angular apps for study 4 32
Phone Dialer 5 36
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now