Table in HTML not presented correctly - html

My code generates the following html file. As you can see the table tag is at the beginning of the code, but when we display it in a browser, the table is always at the end of the page. Can any one explain why it happens?
<table border = '1'><tr><td>count(*)</td></tr><tr><td>3616</td> </tr>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Project 1B</title><meta http-equiv="Content- Type" content="text/html; charset=iso-8859-1" /></head>
<body>
<form method="GET">
<p><h3>Project 1B: Queries</h3></p>
<p>Type an SQL query in the following box:
</p>
<TEXTAREA NAME="area" ROWS=20 COLS=100>select count(*) from Movie;
</TEXTAREA>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>
<hr />
<h3>Report:</h3>
</body>
</html>

I imagine it's because your <table> tag appears before your <html> tag. Try changing your code to generate the <html> then the <table> tags.

Thanks every one, it turns out that I forget to close the table tag and it does all the weird things.

as I said, the browsers will actually fix many errors while decoding(parsing) the html

Related

xhtml & html, are there more differences than just the syntax?

I have to hand in a thesis at the university where I have to create a website in xhtml.
We are not allowed to deliver this file in Html 5.
Since all the youtube tutorials and almost all forums only explain about html5, my question is. If I save the file in xhtml and follow the syntax correctly, can I also use every command that is available in html5?
Or are there other restrictions?
I thank you in advance for all replies.
I have to hand in a thesis at the university where I have to create a website in xhtml.
We are not allowed to deliver this file in Html 5.
Since all the youtube tutorials and almost all forums only explain about html5, my question is. If I save the file in xhtml and follow the syntax correctly, can I also use every command that is available in html5?
Or are there other restrictions?
A XHTML page includes some strict elements and is a more strict and standardized version of HTML, with a syntax that follows the rules of XML - that's what makes it different from an HTML page. For instance, all elements must be in lowercase, empty elements must be closed with a closing slash, and attribute values must be quoted. Also, XHTML requires the use of Unicode encoding (UTF-8 or UTF-16).
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My XHTML Page</title>
</head>
<body>
<h1>Welcome to My XHTML Page</h1>
<p>This is an example of an XHTML page. It follows the syntax rules of XML and is more strict than HTML.</p>
<ul>
<li>All elements must be properly nested and closed.</li>
<li>All attributes must be quoted.</li>
</ul>
<p>Here are some examples of strict elements that are required in XHTML but not in HTML:</p>
<ul>
<li>All elements must be in lowercase.</li>
<li>Empty elements must be closed with a closing slash (e.g., '<br />').</li>
<li>Attribute values must be quoted (e.g., 'href="http://example.com"').</li>
</ul>
<p>Here is an example of a strict XHTML form:</p>
<form action="http://example.com/submit" method="post">
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
<br />
<label for="email">Email:</label>
<input type="email" name="email" id="email" />
<br />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Bottom-line: Yes, you can use most HTML5 elements and attributes in an XHTML document.

How to create html form that directly goes to specific search on a website?

I know that the code below will go to the result page of google when the user types some texts and the submit button is clicked.
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Hello!
</title>
</head>
<body>
<form action="https://www.google.com/search" method="get">
<input name="q" type="text">
<input type="submit" value="Submit Form">
</form>
</body>
</html>
But I try this with https://www.jitta.com/. It does not seem to have the same structure as google.
When searching on this website the url will be https://www.jitta.com/stock/bkk:ptt where "ptt" is the word that I want to search. Unlike google, if I want to search "ptt" the url will be https://www.google.com/search?q=ptt.
Can it be only HTML code? no other parts involved (like Javascript,...)
Appreciate anyone who answers this.

input type tag missing in browser when tested through wordpress

I've started coding html in wordpress. I have a html code with label tag and an input tag of type "text". The input field is not getting displayed in browser. The same code works fine in eclipse. What might be the problem. When I save the post as draft the tag disappears. Not able to solve the issue. Kindly help me in this regard.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hello testing</title>
</head>
<body>
<div> <label> Name:</label> <input type="text"> </div>
</body>
</html>
Above image is the code run through eclipse
Above one is the image run through wordpress preview
when writing html in the Wordpress editor, you can only use tags that are allowed by Wordpress. Dont think the input tag is one if them.
Look at this:
https://en.support.wordpress.com/code/#html-tags
The "input" tag is not supported by WordPress editor.

there is no attribute "placeholder" and there is no attribute "autocomplete"

I have the following errors on my page, when validated with http://validator.w3.org/
there is no attribute "placeholder"
there is no attribute "autocomplete"
in details it says:
Line 59, Column 81: there is no attribute "placeholder"
…rd" type="text" style="width:500px;" placeholder=" What" autocomplete="off" />
✉
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 often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in
the document type you are using, as an undefined element will have no
supported attributes; in this case, see the element-undefined error
message for further information.
How to fix: check the spelling and case of the element and attribute,
(Remember XHTML is all lower-case) and/or check that they are both
allowed in the chosen document type, and/or use CSS instead of this
attribute. If you received this error when using the element
to incorporate flash media in a Web page, see the FAQ item on valid
flash.
the html tag is here: <input name="keyword" id="keyword" type="text" style="width:500px;" placeholder=" What" autocomplete="off" />
If you are using html5 then you should use normal doctype.
<!DOCTYPE HTML>
<html>
<head>
<TITLE>My first HTML document</TITLE>
</head>
<body>
<input name="keyword" id="keyword" type="text" style="width:500px;" placeholder=" What" autocomplete="off" />
</body>
</html>
if you are using html4 or anything else then you can use following one of this
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
For more info..
http://www.w3.org/TR/html-markup/syntax.html#normal-doctype
make sure your using the html5 doctype <!DOCTYPE html>
And that the validator is validating HTML5

HTML displays differently in JSP vs. HTML file

I have what amounts to very basic HTML inside of a JSP page of my Java web-app. The crux of what I'm trying to do is wrap text in an input button of fixed width (IE7). It does not work in my JSP (the text is cutoff). However, if I create an HTML file and open it with the same browser, it works fine. The contents of the .JSP and .HTML are the same, as posted below. What am I missing here? Shouldn't they behave the same?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test</title>
</head>
<body>
<input type="button" value="A lot of descriptive text on a button" style="width:100px; white-space:normal;" />
</body>
</html>