View Full Version : "image of the day": getting rid of the border.
loser
12-09-2002, 06:54 PM
Hi,
I downloaded this code that shows a different image for every day of the week. The problem is that there is a bright blue border around the images. could anyone tell me how to get rid of the border please?..
Here is the code:
"<script language="javascript1.1">
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>"
thanks in advance.
piglet
12-09-2002, 07:52 PM
Hi,
I'm surprised that you get a border with that - are you quite sure that it's not on the image itsself?
I've tried it with my own images in Opera, IE, Netscape 4, and Phoenix and none of them give a border.
You could always add border=0 to be totally sure:
document.write("<img src='" + arday[day] + "' border=0>");
joh6nn
12-09-2002, 07:53 PM
document.write('<img src="' + arday[day] + '" border="0">');
loser
12-09-2002, 08:12 PM
thanks alot - that did the trick. It defenitely had a border before.
I just downlaoded that script for quickness but i want to actually learn the script myself.
could you reccomend any sites or books?
thanks again.
misterx
12-09-2002, 08:20 PM
Originally posted by loser
thanks alot - that did the trick. It defenitely had a border before.
I just downlaoded that script for quickness but i want to actually learn the script myself.
could you reccomend any sites or books?
thanks again.
JavaScript goodies is a pretty good book. It's by the same guy that does www.htmlgoodies.com. It's just an easy to understand teaching style. I picked one up at Barnes and Noble.
piglet
12-10-2002, 12:43 PM
Originally posted by joh6nn
document.write('<img src="' + arday[day] + '" border="0">');
Why border="0" and not border=0? It's fine in HTML 4.01 Transitional, and as deprecated would not be allowable in any higher level version than that.
Now - if you'd added alt="" I'd have understood!
joh6nn
12-10-2002, 03:21 PM
because the standard has always required quotes around attribute values, even if the browsers haven't.
piglet
12-10-2002, 03:50 PM
Nah - you're probably confusing HTML transitional and XHTML.
I guess the authority for this is w3.org. According to their validator (http://validator.w3.org), this is fine:
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title> Test </title>
</head>
<body>
<img src="foo.jpg" border=0 alt="">
</body>
</html>
Also fine for 4.01!: <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
joh6nn
12-10-2002, 08:04 PM
from the w3c, http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2
By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa. Authors may also use numeric character references to represent double quotes (") and single quotes ('). For double quotes authors can also use the character entity reference ".
The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). In certain cases, authors may specify the value of an attribute without any quotation marks. We recommend using quotation marks even when it is possible to eliminate them.
krycek
12-10-2002, 08:09 PM
Personally I would say that you are both right ;)
joh6nn - correct about the recommendations of the W3C, but also note that even in your quote, they say it is allowable to leave the quotes out, even though they recommend it.
piglet - correct in that if the W3C validator passes it, it should be ok. However, that does not mean it is good coding practice.
I would say that always using quotes, like joh6nn says, is the best idea, at least, I have always done that, and it IS recommended :D so what can we do against the W3C recommendation, eh? lol :)
::] krycek [::
Roy Sinclair
12-10-2002, 09:38 PM
krycek - joh6nn - correct about the recommendations of the W3C, but also note that even in your quote, they say it is allowable to leave the quotes out, even though they recommend it.
That's only true for older versions of HTML, by the time you get to the xHTML 1.0 specification the quotes are always required (no longer optional) and they must be double quotes, not the single quote. I would always recommend that you code as close to the current standard as possible to give your pages maximum shelf life before your or someone else is forced to come through and bring them up to date because the browsers no longer support the older standards (assuming the major browser vendors ever drop support for bad html much less older html versions).
piglet
12-11-2002, 10:10 AM
Hi,
I was querying the apparantly pedantic and unnecessary correction, while there was a required item (alt=) missing.
by the time you get to the xHTML 1.0 specification the quotes are always required Yes - I'm happy with that, and I do use quotes normally - but as the border attribute of the img tag is deprecated and doesn't exist in any version of HTML/XHTML greater than 4.01 Transitional the correction is specious anyway :rolleyes:
Never mind!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.