473,785 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with the printdate()

Hello,
I am kind of new to this javascript stuff and I am constantly having
problems trying to get my webpage validated. I have the following
<script>printda te();</script> and when I validate it at validator.w3.or g I
get a error the attribute given above is required for an element that you've
used, but you have omitted it. For instance, in most HTML and XHTML document
types the "type" attribute is required on the "script" element and the "alt"
attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and
type="text/javascript" for <script>.
Ok, I tried both of these obtions but it always change my fonts to some
different then what I want it. How can I have it so my fonts will not
change. If more info is needed please let me know.
thank you for your help to this matter
Jul 23 '05 #1
7 1875
mike wrote:
Hello,
I am kind of new to this javascript stuff and I am constantly having
problems trying to get my webpage validated. I have the following
<script>printda te();</script> and when I validate it at validator.w3.or g I
get a error the attribute given above is required for an element that you've
used, but you have omitted it. For instance, in most HTML and XHTML document
types the "type" attribute is required on the "script" element and the "alt"
attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and
type="text/javascript" for <script>.
Ok, I tried both of these obtions but it always change my fonts to some
different then what I want it. How can I have it so my fonts will not
change. If more info is needed please let me know.
thank you for your help to this matter


<script type="text/javascript"> and <style type="text/css"> should have no
affect on how the fonts appear on your page. Provide a link to two examples that
demonstrate what you are talking about, or two simple examples here. Also note
which browsers you are seeing this behaviour in. If someone can reproduce your
problem, they can help you fix it.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #2
Hello,
Thanks for your reply. I attached part of the script that I am having
problems with which someone might be able to help me out with.
<script language="javas cript" type="text/javascript">
<!--
function printdate() {
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday" ;
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";
months = new Array(12)
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September" ;
months[10] = "October";
months[11] = "November";
months[12] = "December";
today = new Date(); day = days[today.getDay() + 1]
month = months[today.getMonth( ) + 1]
date = today.getDate()
year=today.getY ear();
if (year < 2000) year = year + 1900;
document.write ("<font size=1 face='Americana , Arial, Helvetica,
sans-serif' color=003399>" + day +
", " + month + " " + date + ", " + year)
}
More stuff

</script>
<style type="text/css"> <!--
.pviimenudiv td {font-family: "Trebuchet MS", Arial, sans-serif; font-size:
12px}
.pviimenudiv p {font-family: "Trebuchet MS", Arial, sans-serif; font-size:
12px; margin-top: 12px; margin-bottom: 6px}
.pviimenudiv b {font-family: Verdana, Arial, Helvetica, sans-serif;
font-style: normal; color: #666666}
.pviimenudiv a:link {
color: White;
font-family: "Trebuchet MS", Arial, sans-serif;
font-size: 14px;
text-decoration: underline
}
.pviimenudiv a:visited {
color: White;
font-family: "Trebuchet MS", Arial, sans-serif;
font-size: 14px;
text-decoration: underline
}
.pviimenudiv a:hover {
color: Red; font-family: "Trebuchet MS", Arial, sans-serif; font-size:
14px;
text-decoration: underline
}
.pviimenudiv a:active {
color: Red; font-family: "Trebuchet MS", Arial, sans-serif; font-size:
14px;
text-decoration: underline
}
-->
</style>
</head>
<body bgcolor="#FFFFF F" text="#000000"
onLoad="P7_setM enuMagic1(10,40 ,10,'p7menubott om','p7menu1',' p7submenu1','p7 m
but1','p7menu2' ,'p7submenu2',' p7mbut2','p7men u3','p7submenu3 ','p7mbut3','p7 m
enu4','p7submen u4','p7mbut4',' p7menu5','p7sub menu5','p7mbut5 ');P7_MM1dwt(); I
nitAnim();">
<bgsound src="C:\My Documents\test. mids">
<div id="p7menu1" style="position :absolute; left:20px; top:220px;
width:160px; z-index:106"><a href="javascrip t:;"
onClick="P7_tri gMenuMagic1('p7 menu1',1);retur n false"
onMouseOver="P7 _rollCMenu1(eve nt,'p7menu1',0) "
onMouseOut="P7_ rollCMenu1(even t,'p7menu1',0)"
onFocus="if(thi s.blur)this.blu r()"><img src="butt1.gif" width="160"
height="22" name="p7mbut1" border="0" alt="menu 1"></a></div>
<div id="p7menu2" style="position :absolute; left:20px; top:242px;
width:160px; z-index:107"><a href="javascrip t:;"
onClick="P7_tri gMenuMagic1('p7 menu2',1);retur n false"
onMouseOver="P7 _rollCMenu1(eve nt,'p7menu2',0) "
onMouseOut="P7_ rollCMenu1(even t,'p7menu2',0)"
onFocus="if(thi s.blur)this.blu r()"><img src="butt2.gif" width="160"
height="22" name="p7mbut2" border="0" alt="menu 2"></a></div>
<div id="p7submenu1 " class="pviimenu div" style="position :absolute;
left:200px; top:242px; width:150px; visibility: hidden; z-index:101">
<table width="150" border="0" cellspacing="6" cellpadding="0" >
<tr>
<td><a href="index.htm l">Home Page</a></td>
</tr>
</table>
</div>
<div id="p7submenu2 " class="pviimenu div" style="position :absolute;
left:200px; top:264px; width:150px; visibility: hidden; z-index:102">
<table width="150" border="0" cellspacing="6" cellpadding="0" >
<tr>
<td><a href="test_page s/test.html">test </a></td>
</tr>
</table>
</div>
<td valign="top">
<table width=468 border=0 align="center" cellpadding=0 cellspacing=0
style="border: 1px;"><tr><td>
<div id="surfer3" style="position :absolute"><img src="test.gif"
alt="test"></div>
<div id="surfer4" style="position :absolute"><img src="test.gif"
alt="test"></div>
<div id="surfer5" style="position :absolute"><img src="test.gif"
alt="test"></div>
<div id="surfer6" style="position :absolute"><img src="test.gif"
alt="test"></div>
<ilayer name="waves34i" ><div id="waves34"><i mg src="test.gif"
alt="test"></div></ilayer>
</td></tr></table>

<br><hr size=1>
<script>printda te();</script>
"Grant Wagner" <gw*****@agrico reunited.com> wrote in message
news:41******** *******@agricor eunited.com...
mike wrote:
Hello,
I am kind of new to this javascript stuff and I am constantly having
problems trying to get my webpage validated. I have the following
<script>printda te();</script> and when I validate it at validator.w3.or g I get a error the attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and
type="text/javascript" for <script>.
Ok, I tried both of these obtions but it always change my fonts to some
different then what I want it. How can I have it so my fonts will not
change. If more info is needed please let me know.
thank you for your help to this matter
<script type="text/javascript"> and <style type="text/css"> should have no
affect on how the fonts appear on your page. Provide a link to two

examples that demonstrate what you are talking about, or two simple examples here. Also note which browsers you are seeing this behaviour in. If someone can reproduce your problem, they can help you fix it.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #3
JRS: In article <uL************ *******@newsrea d1.news.pas.ear thlink.net
, dated Fri, 13 Aug 2004 01:24:42, seen in news:comp.lang. javascript, mike <nogood@?.inval id> posted :

Read the newsgroup FAQ. Responses should go after trimmed quotes.
Thanks for your reply. I attached part of the script that I am having
problems with which someone might be able to help me out with.
<script language="javas cript" type="text/javascript">
<!--
function printdate() {
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday" ;
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";
Space-wasting. days = ["Sunday", ..., "Saturday"]
months = new Array(12)
Likewise
today = new Date(); day = days[today.getDay() + 1]
month = months[today.getMonth( ) + 1]
date = today.getDate()
year=today.getY ear();
if (year < 2000) year = year + 1900;
Does not always work. See FAQ & via sig.
document.write ("<font size=1 face='Americana , Arial, Helvetica,
sans-serif' color=003399>" + day +
", " + month + " " + date + ", " + year)
Forcing font size in that way may be contrary to the spirit of the DDA.
Hash may be needed before 003399.
That date format is not suitable for Internet use; follow ISO 8601.
... "Grant Wagner" <gw*****@agrico reunited.com> wrote in message
news:
... ...


<FAQENTRY>

IMHO, 2.10 should be Multinationalis ation. That is adjustment for
different locales, whereas Internationalis ation means using a single
form acceptable everywhere. dependant -> dependent.

It would be a good place to recommend, as an example, internationalis ing
to ISO 8601.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #4
> >function printdate() {
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday" ;
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";


Space-wasting. days = ["Sunday", ..., "Saturday"]
months = new Array(12)


These are not the same.

The OP has "Sunday" in array element 1 where you have it in zero.

The statement days = new Array(7) allocates 7 memory locations
starting with
days[0] to days[6]. Your reference to day[7] works fine because
Javascript dynamically allocates memory for the array elements. You
can also declare the array by doing:
days = new Array()

or

days = [ ]

Also, your statement allocated days to the global variable pool. To
have the variable defined to just the function, do

var days = [ ];

Robet
Jul 23 '05 #5
On 13 Aug 2004 21:34:18 -0700, Robert <rc*******@my-deja.com> wrote:
function printdate() {
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday" ;
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";


Space-wasting. days = ["Sunday", ..., "Saturday"]
months = new Array(12)


These are not the same.

The OP has "Sunday" in array element 1 where you have it in zero.


That's because the OP needlessly converts the ordinal from zero- to
one-based. The simple fix to change:

var day = days[today.getDay() + 1];

to

var day = days[today.getDay()];

Shorter. Simpler. Quicker.

Likewise with month. I feel that Dr Stockton should have mentioned it,
though. Perhaps he thought it obvious.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail
Jul 23 '05 #6
Hello,
Thanks for all your great suggestions but can someone try to help me with
the problem of trying to validate this.
"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opscp1pnt8 x13kvk@atlantis ...
On 13 Aug 2004 21:34:18 -0700, Robert <rc*******@my-deja.com> wrote:
function printdate() {
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday" ;
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";

Space-wasting. days = ["Sunday", ..., "Saturday"]

months = new Array(12)


These are not the same.

The OP has "Sunday" in array element 1 where you have it in zero.


That's because the OP needlessly converts the ordinal from zero- to
one-based. The simple fix to change:

var day = days[today.getDay() + 1];

to

var day = days[today.getDay()];

Shorter. Simpler. Quicker.

Likewise with month. I feel that Dr Stockton should have mentioned it,
though. Perhaps he thought it obvious.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail

Jul 23 '05 #7
"mike" <nogood@.invali d> wrote in message news:<RT******* ********@newsre ad2.news.pas.ea rthlink.net>...
Hello,
Thanks for all your great suggestions but can someone try to help me with
the problem of trying to validate this.


I have not seen the output from the validator, but the text field is
required in the script tag. Try:

<SCRIPT type="text/javascript">
printdate();
</script>
You provided a rather large code fragment. We cannot copy and paste
it into a file and run it to see what any problems are. Please
provide a link or a working example. The code fragement you provide
is rather large and complex. It includes about everything but the
kitchen sink: styles, div, table, and iframe.

We may have gotten distracted my the complexity of the fragment. You
original post was about some error messages from the W3C verifier.
Could you provide details about what version of the verifier you are
using, the error messages you got, and an exact copy of the file you
used. Could you trim down the file to a small size and give the error
message you see.

This is a JavaScript forum. You have gotten some great people to
respond to your post.

Robert
Jul 23 '05 #8

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

Similar topics

21
6557
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help Workshop program: hcw.exe that's included with Visual Basic. This exact same file compiled perfectly with no notes, warnings or errors prior to reformatting my system. Prior to the reformatting, I copied the help.rtf file onto a CD and checked the box to...
6
6328
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334, column 13: there is no attribute "SRC" <bgsound src="C:\My Documents\zingwent.mids"> You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is...
6
4351
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
3
3364
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With numarray, help gives unhelpful responses:
7
5387
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available from clicking on many of the available topics (mostly methods but some properties are also unavailable). This same problem occurs with many, if not most, keywords. Is there any way I can activate these "missing" help topics? HELP!
5
3280
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time using "F1" help within the VB IDE. Is this expectation achievable In trying to test my help file in the IDE, I have a solution with 2 projects: the DLL and a tester. VB does not look for my help file; instead, it looks for path to my source code...
1
352
by: Jamiil | last post by:
This is the first time I am ever using JavaScript, I am not even elocuent in HTML, all I am is someone who has Microsoft/Netscape Webpage developers. What I am trying to say is that I am not an expert in any of these webpage developing laguages. Now, having said that, here is my problem. I got this program from the book JavaScript The definive Guide 3rd Edition, by David Flanagan, published by O'Reilly, <SCRIPT LANGUAGE="JavaScript">...
8
3235
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both including search the internet for help, but the help is worthless. Any ideas?
10
3366
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably the worst I ever seen. I almost cannot find anything I need, including things I
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.