error in javascirpt

S

sander de maaijer

can anybody tel me what i do wrong ???
my problem is that when i type the "TDR"number in
and click on OK i can't see the tables

greet sander

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">






<script>
<!--
/*Personalization script part two By Jason Cooper
May Be used/modified if credit is retained*/
alert("vul alle informatie correct in !!!")
/* The prompt may be changed*/
var tdr=prompt("Wat Is Het TDR Nummer ?","")
//-->
</script>
<script>



<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br>
</p>
<table width="362" border="1" bgcolor="#FFFFFF" bordercolor="#000000">
<tr>
<td width="25%">TDR:</td>
<td width="75%">document.write(tdr)</td>
</tr>
</table>
<br>
<table width="362" border="1" bgcolor="#FFFFFF" bordercolor="#000000">
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td bordercolor="#FFFFFF" width="25%"><font face="Arial, Helvetica,
sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">SF.</font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">CYL.</font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">AX.</font></td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="25%"><font face="Arial, Helvetica, sans-serif">R</font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="25%"><font face="Arial, Helvetica, sans-serif">L</font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
</tr>
</table>
<br>
</script>
<hr>
<font size="1" color="#999999">&copy;Sander de Maaijer</font>
</body>
</html>
 
T

Thomas Hoheneder

Hello,

the error is caused within the following piece of code:
var tdr=prompt("Wat Is Het TDR Nummer ?","")
//-->
</script>
<script>



<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

var tdr=prompt("Wat Is Het TDR Nummer ?","")
//-->
</script>



<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>


Nice greetings from
Thomas
 
S

sander de maaijer

sorry i don't see the diverance

sander de maaijer said:
can anybody tel me what i do wrong ???
my problem is that when i type the "TDR"number in
and click on OK i can't see the tables

greet sander

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">






<script>
<!--
/*Personalization script part two By Jason Cooper
May Be used/modified if credit is retained*/
alert("vul alle informatie correct in !!!")
/* The prompt may be changed*/
var tdr=prompt("Wat Is Het TDR Nummer ?","")
//-->
</script>
<script>



<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br>
</p>
<table width="362" border="1" bgcolor="#FFFFFF" bordercolor="#000000">
<tr>
<td width="25%">TDR:</td>
<td width="75%">document.write(tdr)</td>
</tr>
</table>
<br>
<table width="362" border="1" bgcolor="#FFFFFF" bordercolor="#000000">
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td bordercolor="#FFFFFF" width="25%"><font face="Arial, Helvetica,
sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">SF.</font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">CYL.</font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">AX.</font></td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="25%"><font face="Arial, Helvetica,
 
S

sander de maaijer

this is wat i now have
but its not working


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">






<script>


alert("vul alle informatie correct in !!!")

var tdr=prompt("Wat Is Het TDR Nummer ?","")


</script>




<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br>
</p>
<table width="362" border="1" bgcolor="#FFFFFF" bordercolor="#000000">
<tr>
<td width="25%">TDR:</td>
<td width="75%">document.write(tdr)</td>
</tr>
</table>
<br>
<table width="362" border="1" bgcolor="#FFFFFF" bordercolor="#000000">
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td bordercolor="#FFFFFF" width="25%"><font face="Arial, Helvetica,
sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">SF.</font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">CYL.</font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">AX.</font></td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="25%"><font face="Arial, Helvetica, sans-serif">R</font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="25%"><font face="Arial, Helvetica, sans-serif">L</font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"></font></td>
</tr>
</table>
<br>
<hr>
<font size="1" color="#999999">&copy;Sander de Maaijer</font>
</body>
</html>
 
T

Thomas Hoheneder

Hello,

now there is still one mistake, you're right. You must REPLACE the following
line

<td width="75%">document.write(tdr);</td>

with THAT code:

<td width="75%">
<script language="JavaScript">
document.write(tdr);
</script>
</td>


The reason for this is:
document.write(tdr); is pure javascript code and cannot be understood by
HTML. So it must be put into a <script></script> block.

Nice greetings from
Thomas
 
R

Randy Webb

Thomas said:

<--snip-->

Does aioe.org teach there users how to quote what they are replying to?

In the event that they don't, please consult the c.l.j FAQ and read it
in its entirety, with special attention to section 2.3 paragraph 6.
 
S

sander de maaijer

how do you mean validate your HTML first
wats wrong with my html code ?

sander de maaijer said:
can anybody tel me what i do wrong ???
my problem is that when i type the "TDR"number in
and click on OK i can't see the tables

greet sander

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">






<script>
<!--
/*Personalization script part two By Jason Cooper
May Be used/modified if credit is retained*/
alert("vul alle informatie correct in !!!")
/* The prompt may be changed*/
var tdr=prompt("Wat Is Het TDR Nummer ?","")
//-->
</script>
<script>



<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br>
</p>
<table width="362" border="1" bgcolor="#FFFFFF" bordercolor="#000000">
<tr>
<td width="25%">TDR:</td>
<td width="75%">document.write(tdr)</td>
</tr>
</table>
<br>
<table width="362" border="1" bgcolor="#FFFFFF" bordercolor="#000000">
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td bordercolor="#FFFFFF" width="25%"><font face="Arial, Helvetica,
sans-serif"></font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">SF.</font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">CYL.</font></td>
<td width="25%"><font face="Arial, Helvetica,
sans-serif">AX.</font></td>
</tr>
<tr bordercolor="#000000" bgcolor="#FFFFFF">
<td width="25%"><font face="Arial, Helvetica,
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Wed, 13 Oct 2004 19:44:44, seen in Andrew
Thompson said:
To whom and/or what are you replying?
Please quote a little of what you are replying to, in future.


That's what the validator is for.. <http://validator.w3.org/check>
it can tell you where the 39 errors are, quicker than you can find
out through a usenet thread.

For intermittently-connected users with suitable computers, a local HTML
validator is a more convenient recommendation - I currently use TIDY (1
Nov 2003) as a tester, and it finds no errors but gives 18 warnings.

Granted, that Web one may do a better job; but it is better to first
clean muddy boots with a yard-broom before starting with the polish-
brush.

Alas, I can no longer reach the latest TIDY - did you ever discover what
kills MSIE4?

I run TIDY from a batch file, which tests all *.htm new since the last
run, using TIDY and a couple of minor tools too. See TRY, HUNT, CHK-
TIDY, TRIMENDS, LONGLINE <URL:http://www.merlyn.demon.co.uk/programs/>
and sig.
 
M

Michael Winter

how do you mean validate your HTML first
wats wrong with my html code ?

A fair bit. The most notable problem is that it's out-of-date. At present
you're using presentational HTML. Whilst that used to be fine about five
years ago, CSS should now take the place of attributes like bgcolor, and
elements like FONT. Another problem is the hacks you've employed. Adding
empty paragraphs to shift an element down the viewport is a horrible
technique, that thankfully, is not longer required.

I'll comment on both the style of your mark-up, as well as its mistakes.
I'd still run it through the validator (<URL:http://validator.w3.org/>) in
case I miss something.

[snip]

All HTML documents require a DOCTYPE. This declaration specifies what a
browser can expect when it parses the mark-up. All modern pages should be
written using the Strict variation, with legacy pages written with
Transitional, if necessary. See

These two attributes are deprecated. You can use a CSS rule to specify the
colours for the page and these will be inherited by any descendants.

body {
background-color: #ffffff;
color: #000000;
}

You can find information on how to include CSS information in a HTML
document at <URL:http://www.w3.org/TR/html4/present/styles.html>. The
current CSS specifications are:

Level 1 <URL:http://www.w3.org/TR/CSS1/>
Level 2 <URL:http://www.w3.org/TR/CSS2/>
Level 2.1 <URL:http://www.w3.org/TR/CSS21/>

Although 2.1 isn't as mature as the other two, it is recommended on the
HTML groups as it represents the current state of CSS implementations (or
at least it's supposed to).

The SCRIPT element requires a type attribute which specifies what language
is used. Do not use the language attribute. It is deprecated and using the
type attribute makes it redundant.


Hiding scripts from old browsers is an obsolete technique. There are no
browsers in use on the Web that do not understand what a SCRIPT element
is. They may not be able to execute the script, but they will not render
the contents. Remove the SGML comment delimiter.

Someone expects credit for a prompt call? Right...

This should be removed along with the other comment delimiter.

You've already been told that this should be deleted.

As I already stated at the beginning of this post, padding with empty
elements is nasty. If you want to create a margin, do it properly.

/* Combine the table attributes into a common rule.
* The colours will be inherited from the earlier
* body rule.
*/
table {
border: 1px solid #000000;

/* Specifying pixel sizes should be avoided.
* It rarely facilitates fluid design.
*/
width: 362px;
}

/* Give the first table an id attribute, replacing
* the value, myId, below accordingly.
* This particular rule will add the equivalent of
* four blank lines to the top of the table.
*/
#myId {
margin-top: 4em;
}


The width attribute is deprecated on most elements, including table cells.
You should use COL elements.

<col width="25% 75%">
<tr>
<td>TDR:</td>
<td><script type="text/javascript">
document.write(tdr);
</script></td>
</tr>

Why you are actually using a table at all is a little confusing. Tables
shouldn't be used for laying-out non-tabular data[1].

Again, a margin would be better.

#myOtherId {
margin-top: 1em;
}


These attributes will be inherited from the table's border properties.

This can be specified with the empty-cells CSS rule. Change the table rule
above to:

#myOtherId {
empty-cells: hide;
margin-top: 1em;
}

This contains a lot of redundant information. If you want this table to
use sans-serif fonts, that can be specified with one rule. Similarly, the
COL element can specify that all four cells should have a width of 25%.
Finally, as column headers, it would be more appropriate to use TH, rather
than TD.

#myOtherId {
empty-cells: hide;
font-family: Arial, Helvetica, sans-serif;
margin-top: 1em;
}

<col span="4" width="25%">
<tr>
<th></th>
<th>SF.</th>
<th>CYL.</th>
<th>AX.</th>
</tr>

The COL element applies to the whole table, so that is only included once.
The other rows will be similar to the one above, except that table data
should use TD elements.

[snip]

Delete that.

Something like:

#signature {
background-color: inherit;
color: #999999;
/* This is about as small as text should ever be specified.
* Body-level text should always be at 100%.
*/
font-size: 80%;
}



A demonstrate of the resulting page can be found here. Some extra CSS was
required to get this demonstration to match your original page; mainly
tweaks to the table model.

<URL:http://www.mlwinter.pwp.blueyonder.co.uk/clj/maaijer/css.html>

[I'll be deleting that page at the end of the month.]

Despite the fact that I've included indentation, CSS, and a few other
bits, the resulting page is still smaller than yours. One advantage of CSS
is that it often results in the transmission of much less data.

Mike


[1] An exception to that rule is if an equivalent CSS layout would be far
too complicated to implement.
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Thu, 14 Oct 2004 20:29:09, seen in Andrew
Thompson said:
Eeehh? Sorry. That conversation seemed to follow on from
discussions of validation but I was confused by this.

'TIDY'?? Killing IE4? Are my pages still croaking your browser?

They were last time that I tried. As I said, TIDY is /inter alia/ an
HTML validator that does not need the Web; but the known route to
download it now contains a browser-croaker.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top