Click to See Complete Forum and Search --> : almost got it but not quite


Raven
11-14-2003, 06:32 AM
the part of the code below in red I know is wrong.. I was thinking last night that I simply can't say see this .gif so I put the .gifs on seperate pages.. now how do I code .. when you calculate the day of birth (DOB) open up the page that matches the DOB in target frame I1.. instead of simply writing text in the pop up window.. know what I mean? I want the code to take the user to the page that corrosponds to the DOB calculated.
do I need a seperate function? to say when this happens open this page? I am not sure how to code it.. I have named all of the pages in all lower case too (sunday, monday etc)
I hate to be a bugger but I need specifically where to put what text, I am just learning .. please and tank you!




<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function calculate() {
month = document.form.month.selectedIndex;
month = document.form.month.options[month].value;
day = document.form.day.selectedIndex;
day = document.form.day.options[day].value;
year = document.form.year.value;

var oyear=year

var dob = " "+ year +", "+month + ", "+day;
var thenx = new Date(dob);

var year=thenx.getYear();
if (year<100) year="19" + thenx.getYear();
else year=thenx.getYear();

if (year > 1969) wyear=year;
else {
if (oyear<1900) {
if (oyear>1800) {
wrelyear= (eval(oyear)-1801)%(28);
wyear = wrelyear+1981;
}
else wyear = 1970
}
else
if (oyear>1900) {wrelyear= (eval(oyear)-1901)%(28);
wyear= wrelyear+1985
}
else
if (oyear==1900) {wyear= 1990;
}
}
var dob = " "+ wyear +", "+month + ", "+day;
var thenx = new Date(dob);

var theday = thenx.getDay()+1;
var date=thenx.getDate();

var weekday = new Array(6);
weekday[1]="sunday";
weekday[2]="monday"
weekday[3]="tuesday";
weekday[4]="wednesday";
weekday[5]="thursday";
weekday[6]="friday";
weekday[7]="saturday";

if (day != date) alert("Sorry! That appears to be an invalid date!"+day+" ..."+date+"::"+oyear+"..."+year+" "+dob+"=="+wyear+".-.-"+thenx+" "+day+" "+month);
else {
dayborn = weekday[theday];
dob = dayborn + ", " + month + " " + date + ", " + oyear + ".";
<a target="I1" href="+dob+.htm"</a>;
}
}
// End -->
</script>

Raven
11-14-2003, 07:04 AM
ok I have re worked it to have this script in place of the red



if (theday = 1) href= "http://www.ecdollz.com/sunday.htm";
if (theday = 2) href= "http://www.ecdollz.com/monday.htm";
if (theday = 3) href= "http://www.ecdollz.com/tuesday.htm";
if (theday = 4) href= "http://www.ecdollz.com/wednesday.htm";
if (theday = 5) href= "http://www.ecdollz.com/thursday.htm";
if (theday = 6) href= "http://www.ecdollz.com/friday.htm";
if (theday = 7) href= "http://www.ecdollz.com/saturday.htm";

now I do not get any error messages but it still doesn't open the page upon calculate... am I on the right track?

pixelmech
11-14-2003, 08:28 AM
Your syntax is incorrect at the least:


if (theday = 1)


should be:



if (theday == 1)



Checking for equality in JS is *2* = signs. :) A single equal sign is an assignment.

Try that.

Tom