...

View Full Version : Spot the difference



mikewattsuk
12-14-2003, 09:19 PM
I'm trying to design a new site containing ASP code. However it seems I'm being stopped at the first hurdle...

See this html page:

http://www.mike.watts.name/home.htm

And now see the same page in ASP:

http://www.mike.watts.name/home.asp

Using exactly the same code, the HTML page looks the way I want it to but obviously the ASP code isn't being parsed. In the ASP page however, the header is smaller and the table heights aren't having any effect.

Is this due to browser / server / or just the way ASP works?

Any help on this would really be appreciated.

A1ien51
12-14-2003, 10:02 PM
what is exactly wrong?

mikewattsuk
12-14-2003, 10:05 PM
Originally posted by A1ien51
what is exactly wrong?
Like I say the table & cell heights (100%) are being ignored in the ASP version but not in the HTML version.

jeskel
12-14-2003, 11:18 PM
Welcome! :)
maybe could you show us some code?

mikewattsuk
12-14-2003, 11:23 PM
Originally posted by bouchel
Welcome! :)
maybe could you show us some code?
Right click the page and go to 'view source' there's no ASP code controlling the height of the table, that code is exactly the same as the html one. However the same code with a .asp extention makes it ignore the table height.

The two links I pasted are exactly the same page, I just copied and changed the extention of the file to show the difference in the way the pages are being treated.

glenngv
12-15-2003, 02:44 AM
I didn't see any difference. Both tables resize to 100% as I resize the window.

M@rco
12-15-2003, 03:53 AM
I get two different pages. The heading is a different size on each, and the positioning/sizing is different too. They cannot possibly be the same page source!!

Remove all the ASP from the ..HTM page and copy it to .ASP then let us know.

jeskel
12-15-2003, 08:38 AM
Originally posted by mikewattsuk
Right click the page and go to 'view source' there's no ASP code controlling the height of the table, that code is exactly the same as the html one. However the same code with a .asp extention makes it ignore the table height.

well I mean... you could post the code here :)

mikewattsuk
12-15-2003, 01:02 PM
Originally posted by M@rco
I get two different pages. The heading is a different size on each, and the positioning/sizing is different too. They cannot possibly be the same page source!!

Remove all the ASP from the ..HTM page and copy it to .ASP then let us know.
OK, here are the two pages without any ASP code in them at all.

http://www.mike.watts.name/home2.asp

http://www.mike.watts.name/home2.htm

Now this really doesn't make any sense to me as both pages are now displaying incorrectly (the table should fill the page). This could be an HTML issue but then I've tried all commands I can and CSS but nothing affects the height.

The ASP code that was in the page was:

Line 1: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
Line 9-45:

<%
Dim sPath, filesys, count, getValue, update, twohrs

sPath = Request.ServerVariables("Path_Translated")
sPath = Left(sPath,InStrRev(sPath,"\")) & "counter.txt"

Set filesys = CreateObject("Scripting.FileSystemObject")

Set getValue = filesys.OpenTextFile(sPath,1,0)
' get the current value
count = getValue.ReadLine
If Request.Cookies("mikewattsname")("recentvisitor") <> "yes" Then
' increment by 1 before displaying, 'cos they're a newbie
count = Int(count) + 1
End If
' close file
getValue.Close
If Request.Cookies("mikewattsname")("recentvisitor") <> "yes" Then
' only update the value in the text file if they're a newbie

' overwrite old text file with new one
Set update = filesys.CreateTextFile(sPath)

' put new value in text file
update.WriteLine(count)
update.Close

' give them a cookie to make sure it doesn't count them more than once
Response.Cookies("mikewattsname")("recentvisitor") = "yes"
' make it expire in 2 hours' time
twohrs = DateAdd("h", 2, Now)
Response.Cookies("mikewattsname").Expires = twohrs

End If
' put a comma in the number
count = FormatNumber(count, 0, 0, -1, -1)
%>

Line 71: <td align="center" height="100" valign="middle" bgcolor="#CCFFFF"><p align="center">Visitors <%=count%></p>

And that's it for the ASP code. Now, I'm totally confused on this as you can imagine ;) Any ideas would be appreciated.

r0ck1t
12-15-2003, 01:20 PM
I can see what you are saying, the pages do have identical markup.

The ASP file has a little ASP code to update a text based hit counter and then display the value.

If you view the source of the HTML page you can see the ASP code. Once it is removed the two pages are identical.


Unfortunately I have no idea why!

I will say though, if you are using CSS then you should get rid of the inline styling you have.

mikewattsuk
12-15-2003, 01:29 PM
OK case closed, I worked it out!

Maybe someone can enlighten me on the answer however, I had to remove the line:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

and then the page was treated correctly. This line was added by Dreamweaver. However, it seems to stop any table heights being affected.

Roelf
12-15-2003, 01:31 PM
try height="100%"

mikewattsuk
12-15-2003, 01:32 PM
Originally posted by Roelf
try height="100%"
Line 71: <td align="center" height="100" valign="middle" bgcolor="#CCFFFF"><p align="center">Visitors <%=count%></p>

This was supposed to be height 100, it's the footer.

Mhtml
12-15-2003, 02:42 PM
Originally posted by mikewattsuk
OK case closed, I worked it out!

Maybe someone can enlighten me on the answer however, I had to remove the line:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

and then the page was treated correctly. This line was added by Dreamweaver. However, it seems to stop any table heights being affected.

That is a dtd (Doctype Declaration) which essentially tells the browser how to interpret and display the markup.

M@rco
12-15-2003, 03:51 PM
I suspect that the DTD was telling IE to render one way, but then it was encountering the <% %> tags in your HTML page, and therefore switching to another HTML rendering model. Without the tags there's no conflict between what your DTD is telling and what your code is presenting to the browser, and so both documents render identically. Fix your HTML source so that the document renders as you desire, then add the ASP back in and rename to ASP. Assuming your ASP makes no changes to the output delivered to the browser, then the page will display exactly the same as it did before.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum