Solved

load new index by date range in the month

Posted on 1997-03-28
1
160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
RM032397 earned 200 total points
ID: 1265066
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
Suggested Courses

617 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