Striped Fish Posted April 1, 2010 Share Posted April 1, 2010 Okay I'm working on converting HTML into ASP in Response.Write statements so first I ran into the problem with parentheses so I changed those to the ascii characters but they used the '#' symbol and ran into problems with that. So how do I write characters like # symbols? Here's my code. TIA <%Response.Write("<tr><td bgcolor=""#1e1e1e"" class=""Stats-selected""><img class=""img"" src=""http://www.dragonkwest.net/dragonkwest/images/icons/stats.png""><span style=""font-weight:bold;color:white;"">Stats</span> </td><td bgcolor=""#1e1e1e"" class=""non-selected-items""><a href=""?v=items""><img class=""img"" src=""http://www.dragonkwest.net/dragonkwest/images/icons/items.png""></img></td><td bgcolor=""#1e1e1e"" class=""non-selected-Combatabilities""><a href=""?v=attacks""><img class=""img"" src=""http://www.dragonkwest.net/dragonkwest/images/icons/combat-a.png""></img></a></td></tr></table><table cellpadding=""0"" cellspacing=""0"" width=""153px"" class=""list-bottom""><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Strength: "" + str + """);</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Magic Resist: "" + mgr + """);</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Parry: "" + parry + """);</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Melee: "" + melee + """);</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Dodge: "" + dodge + """);</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type="text/javascript">")Response.Write("document.write(""Armour: "" + armour + """);</script></center></td></tr>")%> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 1, 2010 Share Posted April 1, 2010 I'm not real sure why you would want to use ASP to output data that doesn't change, but I'm not aware of any restrictions using # in strings. If you're asking what the HTML entity code is for that character, you can find a list here:http://www.lookuptables.com/ Link to comment Share on other sites More sharing options...
Striped Fish Posted April 1, 2010 Author Share Posted April 1, 2010 I using it because those variables are declared earlier in the javascript by and because those variables change they are retrieved from the Database. And maybe If I give you the presice error you'll understand because I could be misinterpreting it. Here is the error I am receiving: Microsoft VBScript compilation error '800a03ea' Syntax error /testing.asp, line 3 Response.Write("document.write(""Strength: "" + str + """)</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")--------------------------------------------------------------^ And there really should be 2 ';' of these after the 41 but I had to take it away because it kep converting them into right parentheses. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 1, 2010 Share Posted April 1, 2010 It's the number of quotes that it is confused about. You can thank VBScript for using more quotes to escape quotes, but I'll bold the actual string so you can see where the string ends:Response.Write("document.write(""Strength: "" + str + """);</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")It sees that code like this: Response.Write("document.write(""Strength: "" + str + """);</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">") One line writes the text, and then there's a bunch of stuff that it doesn't know what to do with. Link to comment Share on other sites More sharing options...
Striped Fish Posted April 1, 2010 Author Share Posted April 1, 2010 Okay I got the computer to execute but the javascript is invalid: Here's the ASP Code <%Response.Write("<tr><td bgcolor=""#1e1e1e"" class=""Stats-selected""><img class=""img"" src=""http://www.dragonkwest.net/dragonkwest/images/icons/stats.png""><span style=""font-weight:bold;color:white;"">Stats</span> </td><td bgcolor=""#1e1e1e"" class=""non-selected-items""><a href=""?v=items""><img class=""img"" src=""http://www.dragonkwest.net/dragonkwest/images/icons/items.png""></img></td><td bgcolor=""#1e1e1e"" class=""non-selected-Combatabilities""><a href=""?v=attacks""><img class=""img"" src=""http://www.dragonkwest.net/dragonkwest/images/icons/combat-a.png""></img></a></td></tr></table><table cellpadding=""0"" cellspacing=""0"" width=""153px"" class=""list-bottom""><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Strength: "" + str + "");</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Magic Resist: "" + mgr + "");</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Parry: "" + parry + "");</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Melee: "" + melee + "");</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Dodge: "" + dodge + "");</script></center></td></tr><tr><td bgcolor=""#444444""><center><script type=""text/javascript"">")Response.Write("document.write(""Armour: "" + armour + "");</script></center></td></tr>")%> And here's what it returns to the browser. <tr><td bgcolor="#1e1e1e" class="Stats-selected"><img class="img" src="http://www.dragonkwest.net/dragonkwest/images/icons/stats.png"><span style="font-weight:bold;color:white;">Stats</span> </td><td bgcolor="#1e1e1e" class="non-selected-items"><a href="?v=items"><img class="img" src="http://www.dragonkwest.net/dragonkwest/images/icons/items.png"></img></td><td bgcolor="#1e1e1e" class="non-selected-Combatabilities"><a href="?v=attacks"><img class="img" src="http://www.dragonkwest.net/dragonkwest/images/icons/combat-a.png"></img></a></td></tr></table><table cellpadding="0" cellspacing="0" width="153px" class="list-bottom"><tr><td bgcolor="#444444"><center><script type="text/javascript">document.write("Strength: " + str + ");</script></center></td></tr><tr><td bgcolor="#444444"><center><script type="text/javascript">document.write("Magic Resist: " + mgr + ");</script></center></td></tr><tr><td bgcolor="#444444"><center><script type="text/javascript">document.write("Parry: " + parry + ");</script></center></td></tr><tr><td bgcolor="#444444"><center><script type="text/javascript">document.write("Melee: " + melee + ");</script></center></td></tr><tr><td bgcolor="#444444"><center><script type="text/javascript">document.write("Dodge: " + dodge + ");</script></center></td></tr><tr><td bgcolor="#444444"><center><script type="text/javascript">document.write("Armour: " + armour + ");</script></center></td></tr> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 1, 2010 Share Posted April 1, 2010 <script type="text/javascript">document.write("Strength: " + str + ");</script>What's that extra quote doing at the end? Are the variables you're trying to print in the Javascript code defined somewhere else on the page? Link to comment Share on other sites More sharing options...
Striped Fish Posted April 1, 2010 Author Share Posted April 1, 2010 Okay fixed it! You can close. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.