473,408 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

adapting code

I have a need to insert a changing text with the .jpg into this code. Can
you advise, please? I appreciate this newsgroup, Dick Ross

<BODY>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
today = new Date();
day = today.getDay();
arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");

document.write("<img src='" + arday[day] + "'>");
// End -->
</script>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 0.63 KB -->
Jan 24 '06 #1
4 1208
"ross" <ro***@everestkc.net> wrote in message
news:cb***************************@EVERESTKC.NET.. .
I have a need to insert a changing text with the .jpg into this code. Can
you advise, please? I appreciate this newsgroup, Dick Ross

<BODY>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
today = new Date();
day = today.getDay();
arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");

document.write("<img src='" + arday[day] + "'>");
// End -->
</script>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 0.63 KB -->


Is this what your looking for?

<script type="text/javascript">
var now = new Date();
var day = now.getDay();
var arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");
var artxt = new Array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");

document.write("<img src='" + arday[day] + "'>");
document.write("<br>Today is " + artxt[day]);
</script>
Jan 24 '06 #2
ross wrote:
I have a need to insert a changing text with the .jpg into this code. Can
you advise, please? I appreciate this newsgroup, Dick Ross
<SCRIPT LANGUAGE="JavaScript">
today = new Date();
day = today.getDay();
arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");

document.write("<img src='" + arday[day] + "'>");
</script>

<script type="text/javascript">
day = new Date().getDay();
arday = ["sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg"];
artext = ["sunday text", "monday text", "tuesday text",
"wednesday text", "thursday text", "friday text", "saturday text"];
document.write(
"<img src='" + arday[day] + "'>"+"<BR>"+artext[day]);
</script>

Mick

Jan 24 '06 #3
I will give it a try. I am very inept at javascript, so I really appreciate
your help,
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:_a******************************@comcast.com. ..
"ross" <ro***@everestkc.net> wrote in message
news:cb***************************@EVERESTKC.NET.. .
I have a need to insert a changing text with the .jpg into this code. Can
you advise, please? I appreciate this newsgroup, Dick Ross

<BODY>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
today = new Date();
day = today.getDay();
arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");

document.write("<img src='" + arday[day] + "'>");
// End -->
</script>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 0.63 KB -->


Is this what your looking for?

<script type="text/javascript">
var now = new Date();
var day = now.getDay();
var arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");
var artxt = new Array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");

document.write("<img src='" + arday[day] + "'>");
document.write("<br>Today is " + artxt[day]);
</script>

Jan 24 '06 #4
McKirahan wrote:
<script type="text/javascript">
var now = new Date();
var day = now.getDay();
var arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");
var artxt = new Array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");
Since the names of files and weekdays are this similar, `artxt' is not
necessary.
document.write("<img src='" + arday[day] + "'>");
The `img' element requires the `alt' attribute to provide for graceful
degradation.
document.write("<br>Today is " + artxt[day]);
Consecutive calls of document.write() are inefficient and error-prone.
</script>


<script type="text/javascript">
var
now = new Date(),
arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg"),
wkday = arday[now.getDay()],
txt = wkday.charAt(0).toUpperCase()
+ wkday.substr(1).replace(".jpg", "");

document.write(
"<img src='" + wkday + "' alt='" + txt + "'>"
+ "<br>Today is " + txt);
</script>

It should be noted that the restrictions on correctness of client-side dates
apply.
PointedEars
Jan 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
9
by: bigoxygen | last post by:
Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing...
5
by: Jeffrey Barish | last post by:
I have a small program that I would like to run on multiple platforms (at least linux and windows). My program calls helper programs that are different depending on the platform. I think I...
4
by: jason | last post by:
Hello. Newbie on SQL and suffering through this. I have two tables created as such: drop table table1; go drop table table2; go
4
NoPeasHear
by: NoPeasHear | last post by:
My problem - the first cell of my table is adapting the .nav class rather than .menu class that I am assigning it. How can I fix it? My code starts out as the following... <link...
9
by: perls | last post by:
"Newbie needs help" Hi all, I had a programmer do a site scraping script for me.. the aim was to scrape data from 5 different sites and upload directly into my website databse. I started to...
4
by: idorjee | last post by:
hi guys, i've a perl script which does fine when i execute it as follows on unix environment: bash-2.05$ perl <scriptname> But, when i used CGI to output the result a browser, i see nothing....
15
RMWChaos
by: RMWChaos | last post by:
As usual, an overly-long, overly-explanatory post. Better too much info than too little, right? A couple weeks ago, I asked for some assistance iterating through a JSON property list so that my...
2
by: chromis | last post by:
Hi there, I've been reading an OOP book recently and it gives some nice Adaptor / Template patttern code to wrap around the php Mysql functions. I thought that I'd try and create a Simple Address...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.