http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd Made My Code All Wecky. Why?
Hi,
In the original code, there is "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">" in the second line in the html code, it works fine until I added a bunch of <div> inside <td> with css. I spent the whole day debugging the problem and I found that it works fine if I replaced it with "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">". Why? Does it do me any harm if I do that?
Thank you.
Last edited by dealmaker; 05-15-2008 at 12:57 AM..
Hi,
In the original code, there is "<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" >" in the second line in the html code, it works fine until I added a bunch of <div> inside <td> with css. I spent the whole day debugging the problem and I found that it works fine if I remove this xmlns in html tag. Why? Does it do me any harm if I remove xmlns?
Thank you.
without looking to the page is hard to know what's happend but I guess that with default namespace aka xmlns your code is less invalid then without, . Try to validate and if you have problems after that post the link.
Thanks. Actually I just found that it was due to the doctype, not xmlns. I just corrected my post. Please reread my post, and please let me know what you think.
Quote:
Originally Posted by oesxyl
without looking to the page is hard to know what's happend but I guess that with default namespace aka xmlns your code is less invalid then without, . Try to validate and if you have problems after that post the link.
Hi,
In the original code, there is "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">" in the second line in the html code, it works fine until I added a bunch of <div> inside <td> with css. I spent the whole day debugging the problem and I found that it works fine if I replaced it with "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">". Why? Does it do me any harm if I do that?
Thank you.
no, is no problem what doctype you use since the code is valid for that doctype, probably the html code is valid for html 4.01. I suggest to validate, use w3c validator and if is valid and look how you want, I think that you don't have any reason to warry.
If you have errors, fix them and if after that don't look how you want, post link and I help you if I know how,
The following is the code, try to switch between 2 doctype tag then you will see what I am saying. I still can't figure out why...
Code:
<!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" >
<HEAD>
<TITLE>Page 100</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<STYLE type="text/css">
<!--
.ft0{font-size:4px;font-family:Times;color:#272526;}
.ft1{font-size:8px;font-family:Times;color:#272526;}
.ft2{font-size:9px;font-family:Times;color:#272526;}
.ft3{font-size:6px;font-family:Times;color:#272526;}
.ft4{font-size:6px;font-family:Times;color:#fefefe;}
.ft5{font-size:7px;font-family:Times;color:#272526;}
.ft6{font-size:8px;line-height:13px;font-family:Times;color:#272526;}
-->
</STYLE>
</HEAD>
<BODY bgcolor="#A0A0A0" vlink="blue" link="blue">
<div style="position:relative;width:531;height:666;">
<IMG width="531" height="666" src="a100.png" alt="background image">
<div style="position:absolute;top:59;left:110"><nobr><span class="ft0">■■</span></nobr></div>
<div style="position:absolute;top:58;left:125;"><nobr><span class="ft6">ResultSetHoldability—This parameter is not implemented in Connector/J’s<br>implementation of createStatement().</span></nobr></div>
<DIV style="position:absolute;top:91;left:109"><nobr><span class="ft6">When you’re using the createStatement() methods, you include the parameters<br>when you’re creating a ResultSet or use the defaults as appropriate. In most<br>cases, you use createStatement() without any parameters.</span></nobr></DIV>
<DIV style="position:absolute;top:146;left:110"><nobr><span class="ft2"><i>Executing SQL</i></span></nobr></DIV>
<DIV style="position:absolute;top:167;left:110"><nobr><span class="ft6">Now that we have a Statement object, it’s time to execute the SQL statements<br>designed to return results for use in our application. The Statement object<br>includes several types of query methods, as shown in Appendix B. In this sec-<br>tion, we cover the method executeQuery(), which is designed to execute SQL<br>that will return a result. This means the method expects to execute a SELECT<br>query. </span></nobr></DIV>
<DIV style="position:absolute;top:252;left:110"><nobr><span class="ft6">In our example code, the following line sets off the process of retrieving results<br>from the database:</span></nobr></DIV>
<DIV style="position:absolute;top:285;left:121"><nobr><span class="ft3">ResultSet rs = statement.executeQuery("SELECT * FROM acc_acc");</span></nobr></DIV>
<DIV style="position:absolute;top:302;left:110"><nobr><span class="ft6">There are a few things you should note about this code. The first is that the SQL<br>query statement is provided to the executeQuery() method as a String. The<br>object passes the query to the database, which in turn executes it. Connector/J<br>doesn’t, and shouldn’t, make any type of determination on the validity of the<br>SQL being passed by the application. If the database is unable to execute the<br>SQL, a SQLException exception will be thrown. If the command is successful,<br>the executeQuery() method returns a ResultSet object containing the rows<br>from the database. </span></nobr></DIV>
<DIV style="position:absolute;top:412;left:110"><nobr><span class="ft6">Ultimately, three outcomes can occur when the executeQuery() method exe-<br>cutes. The first is an exception. An exception can occur for many reasons,<br>among them are the following:</span></nobr></DIV>
<DIV style="position:absolute;top:456;left:110"><nobr><span class="ft0">■■</span></nobr></DIV>
<DIV style="position:absolute;top:455;left:125"><nobr><span class="ft1">The connection is no longer valid to the database server.</span></nobr></DIV>
<DIV style="position:absolute;top:473;left:110"><nobr><span class="ft0">■■</span></nobr></DIV>
<DIV style="position:absolute;top:472;left:125"><nobr><span class="ft1">The SQL has a syntax error in it.</span></nobr></DIV>
<DIV style="position:absolute;top:490;left:110"><nobr><span class="ft0">■■</span></nobr></DIV>
<DIV style="position:absolute;top:489;left:125"><nobr><span class="ft6">The currently logged-in user doesn’t have permission to the database table<br>used in the SQL.</span></nobr></DIV>
<DIV style="position:absolute;top:522;left:109"><nobr><span class="ft6">You need to wrap your executeQuery() in a try/catch block, but it will be a<br>design issue as to which errors you attempt to recover from and which allow<br>the application to fail. There are some database operation errors that you<br>recover from by changing the nature of the operation—you might be able to<br>connect to a secondary database, or limit the results. Other errors may be cata-<br>strophic, like being unable to update the database. The second outcome is a<br>ResultSet with results in it. This is the most favorable outcome. The third </span></nobr></DIV>
<DIV style="position:absolute;top:29;left:371"><nobr><span class="ft4"><b>Hello World</b></span></nobr></DIV>
<DIV style="position:absolute;top:28;left:449"><nobr><span class="ft5"><b>77</b></span></nobr></DIV>
</DIV>
</BODY>
</HTML>
Quote:
Originally Posted by oesxyl
no, is no problem what doctype you use since the code is valid for that doctype, probably the html code is valid for html 4.01. I suggest to validate, use w3c validator and if is valid and look how you want, I think that you don't have any reason to warry.
If you have errors, fix them and if after that don't look how you want, post link and I help you if I know how,
I looked at the errors, and I found that all of the so called errors are not supposed to affect anything. e.g. it wants all tags to be lowercase, <br> without closing tag, etc. They are all acceptable for all browsers.
Quote:
Originally Posted by oesxyl
validate! you have 140 error with xhtml and 20 with html 4.01.
This will get you to 17 errors. Someone can probably tell you how to get rid of the nobr’s with no-wrap and you will be 100%
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Page 100</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
.ft0{font-size:4px;font-family:Times;color:#272526;}
.ft1{font-size:8px;font-family:Times;color:#272526;}
.ft2{font-size:9px;font-family:Times;color:#272526;}
.ft3{font-size:6px;font-family:Times;color:#272526;}
.ft4{font-size:6px;font-family:Times;color:#fefefe;}
.ft5{font-size:7px;font-family:Times;color:#272526;}
.ft6{font-size:8px;line-height:13px;font-family:Times;color:#272526;}
</style>
</head>
<body bgcolor="#A0A0A0" vlink="blue" link="blue">
<div style="position:relative;width:531;height:666;">
<img width="531" height="666" src="a100.png" alt="background image" />
<div style="position:absolute;top:59;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:58;left:125;"><nobr><span class="ft6">ResultSetHoldability—This parameter is not implemented in Connector/J’s
<br />implementation of createStatement().
</span></nobr></div>
<div style="position:absolute;top:91;left:109"><nobr><span class="ft6">When you’re using the createStatement() methods, you include the parameters
<br />when you’re creating a ResultSet or use the defaults as appropriate. In most
<br />cases, you use createStatement() without any parameters.
</span></nobr></div>
<div style="position:absolute;top:146;left:110"><nobr><span class="ft2"><i>Executing SQL</i>
</span></nobr></div>
<div style="position:absolute;top:167;left:110"><nobr><span class="ft6">Now that we have a Statement object, it’s time to execute the SQL statements
<br />designed to return results for use in our application. The Statement object
<br />includes several types of query methods, as shown in Appendix B. In this sec-
<br />tion, we cover the method executeQuery(), which is designed to execute SQL
<br />that will return a result. This means the method expects to execute a SELECT
<br />query.
</span></nobr></div>
<div style="position:absolute;top:252;left:110"><nobr><span class="ft6">In our example code, the following line sets off the process of retrieving results
<br />from the database:
</span></nobr></div>
<div style="position:absolute;top:285;left:121"><nobr><span class="ft3">ResultSet rs = statement.executeQuery("SELECT * FROM acc_acc");
</span></nobr></div>
<div style="position:absolute;top:302;left:110"><nobr><span class="ft6">There are a few things you should note about this code. The first is that the SQL
<br />query statement is provided to the executeQuery() method as a String. The
<br />object passes the query to the database, which in turn executes it. Connector/J
<br />doesn’t, and shouldn’t, make any type of determination on the validity of the
<br />SQL being passed by the application. If the database is unable to execute the
<br />SQL, a SQLException exception will be thrown. If the command is successful,
<br />the executeQuery() method returns a ResultSet object containing the rows
<br />from the database.
</span></nobr></div>
<div style="position:absolute;top:412;left:110"><nobr><span class="ft6">Ultimately, three outcomes can occur when the executeQuery() method exe-
<br />cutes. The first is an exception. An exception can occur for many reasons,
<br />among them are the following:
</span></nobr></div>
<div style="position:absolute;top:456;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:473;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:472;left:125"><nobr><span class="ft1">The SQL has a syntax error in it.
</span></nobr></div>
<div style="position:absolute;top:490;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:489;left:125"><nobr><span class="ft6">The currently logged-in user doesn’t have permission to the database table
<br />used in the SQL.
</span></nobr></div>
<div style="position:absolute;top:522;left:109"><nobr><span class="ft6">You need to wrap your executeQuery() in a try/catch block, but it will be a
<br />design issue as to which errors you attempt to recover from and which allow
<br />the application to fail. There are some database operation errors that you
<br />recover from by changing the nature of the operation—you might be able to
<br />connect to a secondary database, or limit the results. Other errors may be cata-
<br />strophic, like being unable to update the database. The second outcome is a
<br />ResultSet with results in it. This is the most favorable outcome. The third
</span></nobr></div>
<div style="position:absolute;top:29;left:371"><nobr><span class="ft4"><b>Hello World</b>
</span></nobr></div>
<div style="position:absolute;top:28;left:449"><nobr><span class="ft5"><b>77</b>
</span></nobr></div>
</div>
</body>
</html>
how it is ok to play with your code.
__________________
Dedicate some time to Educate your mind
This works with 2 errors, I got the information from this site http://www.w3.org/International/tuto...enc/#Slide0150
But when I get about 2/3 through the page it starts getting over my head, maybe someone else can pick up if I am on the right track. sorry
Code:
<?xml version="1.0" encoding="iso-UTF-8"?>
<head>
<title>Page 100</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-UTF-8" />
<style type="text/css">
.ft0{font-size:4px;font-family:Times;color:#272526;}
.ft1{font-size:8px;font-family:Times;color:#272526;}
.ft2{font-size:9px;font-family:Times;color:#272526;}
.ft3{font-size:6px;font-family:Times;color:#272526;}
.ft4{font-size:6px;font-family:Times;color:#fefefe;}
.ft5{font-size:7px;font-family:Times;color:#272526;}
.ft6{font-size:8px;line-height:13px;font-family:Times;color:#272526;}
</style>
</head>
<body bgcolor="#A0A0A0" vlink="blue" link="blue">
<div style="position:relative;width:531;height:666;">
<img width="531" height="666" src="a100.png" alt="background image" />
<div style="position:absolute;top:59;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:58;left:125;"><nobr><span class="ft6">ResultSetHoldability—This parameter is not implemented in Connector/J’s
<br />implementation of createStatement().
</span></nobr></div>
<div style="position:absolute;top:91;left:109"><nobr><span class="ft6">When you’re using the createStatement() methods, you include the parameters
<br />when you’re creating a ResultSet or use the defaults as appropriate. In most
<br />cases, you use createStatement() without any parameters.
</span></nobr></div>
<div style="position:absolute;top:146;left:110"><nobr><span class="ft2"><i>Executing SQL</i>
</span></nobr></div>
<div style="position:absolute;top:167;left:110"><nobr><span class="ft6">Now that we have a Statement object, it’s time to execute the SQL statements
<br />designed to return results for use in our application. The Statement object
<br />includes several types of query methods, as shown in Appendix B. In this sec-
<br />tion, we cover the method executeQuery(), which is designed to execute SQL
<br />that will return a result. This means the method expects to execute a SELECT
<br />query.
</span></nobr></div>
<div style="position:absolute;top:252;left:110"><nobr><span class="ft6">In our example code, the following line sets off the process of retrieving results
<br />from the database:
</span></nobr></div>
<div style="position:absolute;top:285;left:121"><nobr><span class="ft3">ResultSet rs = statement.executeQuery("SELECT * FROM acc_acc");
</span></nobr></div>
<div style="position:absolute;top:302;left:110"><nobr><span class="ft6">There are a few things you should note about this code. The first is that the SQL
<br />query statement is provided to the executeQuery() method as a String. The
<br />object passes the query to the database, which in turn executes it. Connector/J
<br />doesn’t, and shouldn’t, make any type of determination on the validity of the
<br />SQL being passed by the application. If the database is unable to execute the
<br />SQL, a SQLException exception will be thrown. If the command is successful,
<br />the executeQuery() method returns a ResultSet object containing the rows
<br />from the database.
</span></nobr></div>
<div style="position:absolute;top:412;left:110"><nobr><span class="ft6">Ultimately, three outcomes can occur when the executeQuery() method exe-
<br />cutes. The first is an exception. An exception can occur for many reasons,
<br />among them are the following:
</span></nobr></div>
<div style="position:absolute;top:456;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:473;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:472;left:125"><nobr><span class="ft1">The SQL has a syntax error in it.
</span></nobr></div>
<div style="position:absolute;top:490;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:489;left:125"><nobr><span class="ft6">The currently logged-in user doesn’t have permission to the database table
<br />used in the SQL.
</span></nobr></div>
<div style="position:absolute;top:522;left:109"><nobr><span class="ft6">You need to wrap your executeQuery() in a try/catch block, but it will be a
<br />design issue as to which errors you attempt to recover from and which allow
<br />the application to fail. There are some database operation errors that you
<br />recover from by changing the nature of the operation—you might be able to
<br />connect to a secondary database, or limit the results. Other errors may be cata-
<br />strophic, like being unable to update the database. The second outcome is a
<br />ResultSet with results in it. This is the most favorable outcome. The third
</span></nobr></div>
<div style="position:absolute;top:29;left:371"><nobr><span class="ft4"><b>Hello World</b>
</span></nobr></div>
<div style="position:absolute;top:28;left:449"><nobr><span class="ft5"><b>77</b>
</span></nobr></div>
</div>
</body>
</html>
__________________
Dedicate some time to Educate your mind
But this has to work with either the doctype xhtml or html tag because I need that for other purpose. Otherwise, I would just remove doctype tag and the code will work without any correction.
Quote:
Originally Posted by radamsiii
This works with 2 errors, I got the information from this site http://www.w3.org/International/tuto...enc/#Slide0150
But when I get about 2/3 through the page it starts getting over my head, maybe someone else can pick up if I am on the right track. sorry
Code:
<?xml version="1.0" encoding="iso-UTF-8"?>
<head>
<title>Page 100</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-UTF-8" />
<style type="text/css">
.ft0{font-size:4px;font-family:Times;color:#272526;}
.ft1{font-size:8px;font-family:Times;color:#272526;}
.ft2{font-size:9px;font-family:Times;color:#272526;}
.ft3{font-size:6px;font-family:Times;color:#272526;}
.ft4{font-size:6px;font-family:Times;color:#fefefe;}
.ft5{font-size:7px;font-family:Times;color:#272526;}
.ft6{font-size:8px;line-height:13px;font-family:Times;color:#272526;}
</style>
</head>
<body bgcolor="#A0A0A0" vlink="blue" link="blue">
<div style="position:relative;width:531;height:666;">
<img width="531" height="666" src="a100.png" alt="background image" />
<div style="position:absolute;top:59;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:58;left:125;"><nobr><span class="ft6">ResultSetHoldability—This parameter is not implemented in Connector/J’s
<br />implementation of createStatement().
</span></nobr></div>
<div style="position:absolute;top:91;left:109"><nobr><span class="ft6">When you’re using the createStatement() methods, you include the parameters
<br />when you’re creating a ResultSet or use the defaults as appropriate. In most
<br />cases, you use createStatement() without any parameters.
</span></nobr></div>
<div style="position:absolute;top:146;left:110"><nobr><span class="ft2"><i>Executing SQL</i>
</span></nobr></div>
<div style="position:absolute;top:167;left:110"><nobr><span class="ft6">Now that we have a Statement object, it’s time to execute the SQL statements
<br />designed to return results for use in our application. The Statement object
<br />includes several types of query methods, as shown in Appendix B. In this sec-
<br />tion, we cover the method executeQuery(), which is designed to execute SQL
<br />that will return a result. This means the method expects to execute a SELECT
<br />query.
</span></nobr></div>
<div style="position:absolute;top:252;left:110"><nobr><span class="ft6">In our example code, the following line sets off the process of retrieving results
<br />from the database:
</span></nobr></div>
<div style="position:absolute;top:285;left:121"><nobr><span class="ft3">ResultSet rs = statement.executeQuery("SELECT * FROM acc_acc");
</span></nobr></div>
<div style="position:absolute;top:302;left:110"><nobr><span class="ft6">There are a few things you should note about this code. The first is that the SQL
<br />query statement is provided to the executeQuery() method as a String. The
<br />object passes the query to the database, which in turn executes it. Connector/J
<br />doesn’t, and shouldn’t, make any type of determination on the validity of the
<br />SQL being passed by the application. If the database is unable to execute the
<br />SQL, a SQLException exception will be thrown. If the command is successful,
<br />the executeQuery() method returns a ResultSet object containing the rows
<br />from the database.
</span></nobr></div>
<div style="position:absolute;top:412;left:110"><nobr><span class="ft6">Ultimately, three outcomes can occur when the executeQuery() method exe-
<br />cutes. The first is an exception. An exception can occur for many reasons,
<br />among them are the following:
</span></nobr></div>
<div style="position:absolute;top:456;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:473;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:472;left:125"><nobr><span class="ft1">The SQL has a syntax error in it.
</span></nobr></div>
<div style="position:absolute;top:490;left:110"><nobr><span class="ft0">■■
</span></nobr></div>
<div style="position:absolute;top:489;left:125"><nobr><span class="ft6">The currently logged-in user doesn’t have permission to the database table
<br />used in the SQL.
</span></nobr></div>
<div style="position:absolute;top:522;left:109"><nobr><span class="ft6">You need to wrap your executeQuery() in a try/catch block, but it will be a
<br />design issue as to which errors you attempt to recover from and which allow
<br />the application to fail. There are some database operation errors that you
<br />recover from by changing the nature of the operation—you might be able to
<br />connect to a secondary database, or limit the results. Other errors may be cata-
<br />strophic, like being unable to update the database. The second outcome is a
<br />ResultSet with results in it. This is the most favorable outcome. The third
</span></nobr></div>
<div style="position:absolute;top:29;left:371"><nobr><span class="ft4"><b>Hello World</b>
</span></nobr></div>
<div style="position:absolute;top:28;left:449"><nobr><span class="ft5"><b>77</b>
</span></nobr></div>
</div>
</body>
</html>
You NEED the doctype. It tells the browser how to render the page. The first doctype you used was partial. The next one you used was the incorrect one because it was pretty clear you weren't using XHTML. You were using HTML. Both the partial doctype and this line
Code:
<?xml version="1.0" encoding="iso-UTF-8"?>
throw IE6 into quirks mode. Haven't you ever wondered why your code looked okay in Firefox but not IE? Its because of poor coding.
Once you start using a complete doctype you need to use units on everything. You have some top and left values without units which is causing your problems.
Why so much absolute positioning? I think you are abusing it and don't even know you are doing so.
Also if that really is page 100 then you are going about things the wrong way. I suggest looking into some type of server side language or a database as its very inefficient to have that many static pages.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
wow, thanks. I add px to all of them, and they all work now without any modification!
I am using firefox btw.
Quote:
Originally Posted by _Aerospace_Eng_
You NEED the doctype. It tells the browser how to render the page. The first doctype you used was partial. The next one you used was the incorrect one because it was pretty clear you weren't using XHTML. You were using HTML. Both the partial doctype and this line
Code:
<?xml version="1.0" encoding="iso-UTF-8"?>
throw IE6 into quirks mode. Haven't you ever wondered why your code looked okay in Firefox but not IE? Its because of poor coding.
Once you start using a complete doctype you need to use units on everything. You have some top and left values without units which is causing your problems.
Why so much absolute positioning? I think you are abusing it and don't even know you are doing so.
Also if that really is page 100 then you are going about things the wrong way. I suggest looking into some type of server side language or a database as its very inefficient to have that many static pages.