A Script Problem - Post ID 19574

User 51909 Photo


Registered User
3,694 posts

Hi - I hope someone can help me with this little problem. I am running a script on my church web site that displays the day, date and any saints day that falls on that day. For example

Saturday, 15 July 2006 - St Bonaventure

Anyhow, I can do this, and it works just fine. What I would like to do is to be able to click on the saints name and goto a new web page that gives a brief history of that saint. I can't figure out how to do this though! Any suggestions? I have included that script below. As I said it works just fine just want to be able to click and goto asnother page. Hope someone can help.

Mark

<script language="JavaScript">
<!--
calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();
if (year< 100) year = 1900 + year;
cent = parseInt(year/100);
g = year % 19;
k = parseInt((cent - 17)/25);
i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30;
i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));
j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
l = i - j;
emonth = 3 + parseInt((l + 40)/44);
edate = l + 28 - 31*parseInt((emonth/4));
emonth--;
var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var monthname =
new Array ("January","February","March","April","May","June","July","August","September","October","November","December" );
document.write(dayname[day]+", ");
document.write(date+" ");
document.write(monthname[month]+" ");
document.write(+"2006");
// January is month 0
if ((month == 0) && (date == 1)) document.write(" - Mary, Mother of God, solemnity");
Mark Loves CoffeeCup
User 8660 Photo


Registered User
858 posts

You are correct, it is a small problem.
Do the following where the scripts if statements are....
Example:
your existing script:

if ((month == 0) && (date == 1)) document.write(" - Mary, Mother of God, solemnity");

change to:

if ((month == 0) && (date == 1)) document.write(" <a href='http://www.yourlink'>- Mary, Mother of God, solemnity</a>");

Basically you write a link to the document instead of just the text. Just make sure to use the apostrophe for the URL!
Alfred
User 51909 Photo


Registered User
3,694 posts

Alfred

What can I say - your a great bloke - cheers (A British southerners way of saying your very kind and thank you very much).

This internet stuff is great - there are always people, though not as nice as you, willing to help out.

Thank you
Mark Loves CoffeeCup
User 51909 Photo


Registered User
3,694 posts

Alfred

Just tried your changes to the script - works a treat

Ta
Mark Loves CoffeeCup
User 51909 Photo


Registered User
3,694 posts

Alfred Kypta wrote:
You are correct, it is a small problem.
Do the following where the scripts if statements are....
Example:
your existing script:

if ((month == 0) && (date == 1)) document.write(" - Mary, Mother of God, solemnity");

change to:

if ((month == 0) && (date == 1)) document.write(" <a href='http://www.yourlink'>- Mary, Mother of God, solemnity</a>");

Basically you write a link to the document instead of just the text. Just make sure to use the apostrophe for the URL!

Alfred

The advise you gave me works great - does the job, apart from one small thing! I would like the link to open in a new window (pref a pop-up-window rather than the full thing), but instead, it opens in a in a small frame where the script results appear. The code I am using is being called using this:

<iframe name="datefunc" frameborder="0" marginheight="1" marginwidth="1" scrolling="no" src="date.htm" style="position:absolute; left:240; top:40; width:372px; height:20px; z-index:2; font-family:Verdana; font-size:8pt; color:#135393" class="fixedfont" align="left"></iframe>

What could I include in the original script you helped me with to achieve this? Hope you can help.

Thanks in advance

Maqrk
Mark Loves CoffeeCup
User 8660 Photo


Registered User
858 posts

Try the following Mark...

if ((month == 0) && (date == 1)) document.write(" <a href='http://www.yourlink' target='_blank'>- Mary, Mother of God, solemnity</a>");
This might work, but honestly, I'm not sure and I don't have the time tonight to try it out.
I did delete your other post Mark.
Alfred

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.