Jump to content

newb error


kehopper

Recommended Posts

I just started working with ASP (like yesterday), and I was trying to follow a W3schools tutorial, but when I copied and pasted the text into my file and tried to view the output, I recieved the error:Error Type:Microsoft VBScript compilation (0x800A0400)Expected statement/MyWeb/test1.asp, line 4\parthe code I used is:<html><body><%response.write("<h2>You can use HTML tags to format the text!</h2>")%><%response.write("<p style='color:#0000ff'>This text is styled with the style attribute!</p>")%></body></html>and the file is located in C:\Inetpub\wwwroot\MyWeb (don't know if that helps or not).I tried testing the code in both firefox and ie and they both gave me the same error.If anyone could explain to me what's wrong I would greatly appreciate it. Thanks!

Link to comment
Share on other sites

maybe i've been taught ASP in a funny way but this usually works for me:you have,<%response.write("<p style='color:#0000ff'>This text is styled with the style attribute!</p>")%>where i would use double " for the paragraphs style:<%response.write("<p style=""color:#0000ff"">This text is styled with the style attribute!</p>")%>what that basically does is goes out of ASP into html to write <p style=, then it comes out of html into asp then back into html to write color: #0000ff, out of html then back into html to finnish the statement off.i think the ASP is seeing the ' as a comment notation, thus why it's expecting a statement.edit: also what you could do is<p style="color:#0000ff"><%= This text is styled with the style attribute! %></p>but that tends to be more useful when your working with variables:<% dim StrSQLStrSQL = "This is the SQL String"%><p style="color: #0000ff"><%= StrSQL %></p><%= is the same as saying response.write :)

Link to comment
Share on other sites

Hey thanks! Substituting the <% for the response.write definitely took care of the error, but when I look at my page, it has all of the essential text I put in formatted appropriately, but there's a bunch of random path names being displayed on the page as well such as \par\par and {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20 \par \par . Also, I get the feeling that the \par bares some sort of significance but, I have no clue what. Any tips that could clear up all these excess path names or explain what \par is referring to would be amazing!

Link to comment
Share on other sites

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20 \par \par
All of that is RTF code. What are you doing that has anything to do with an RTF file? (/par indicates a new paragraph in an RTF document) Are you creating your script with something like Wordpad and saving it as an RTF file?
Link to comment
Share on other sites

Oooohhh, okay. That would explain everything. I WAS coding it in wordpad, and didn't realize that even though I labeled the file as a .asp that it was still being saved as an RTF. Thanks a bunch for the explanation! :)

Link to comment
Share on other sites

Multi-character non-numeric escaped entities are usually an indication of a complex format (such as RTF). So when you see those, think "Save as plain text" :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...