473,471 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Quotes 2

Below in GOOD CODE, I have a mix of ASP/HTML that works. I'm trying to
convert the code into all ASP, but I'm failing in BAD CODE. Can someone help
me with these quotes? The single quotes are very hard to master.
BAD CODE:

sHTML=sHTML & "bgcolor=" & tblcolor & style=""cursor:default;""
onMouseOver="this.bgColor=""'#e6e6e6'"" onMouseOut="this.bgColor='" &
tblcolor & "'"

GOOD CODE:

<%
If sPageType = "forum" Then %>

bgcolor="<%= tblcolor %>" style="cursor:default;"
onMouseOver="this.bgColor='#e6e6e6'" onMouseOut="this.bgColor='<%= tblcolor
%>'"

<% End If %>>
Aug 21 '05 #1
6 1474
scott wrote:
Below in GOOD CODE, I have a mix of ASP/HTML that works. I'm trying to
convert the code into all ASP, but I'm failing in BAD CODE. Can
someone help me with these quotes? The single quotes are very hard to
master.


Look, to escape a quote, double it up:

Response.write "here is a literal quote: "" - see?"

Until you get the hang of it, don't try to do it all at once. Start with the
string fragments:

sHTML= "bgcolor="
response.write sHTML

Running this should result in:
bgcolor=

Now you want an opening quote, so change it to:
sHTML= "bgcolor="""
response.write sHTML

Running it should result in
bgcolor="

Now add the variable:

sHTML= "bgcolor=" & tblcolor

Test it.
Add the closing quote:

sHTML= "bgcolor=" & tblcolor & """"

Test it.
Now add the word "style=":

sHTML= "bgcolor=" & tblcolor & """ style="

Again, test it.
Add the opening quote:
sHTML= "bgcolor=" & tblcolor & """ style="""

Keep going ...

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 21 '05 #2
scott wrote on 21 aug 2005 in microsoft.public.inetserver.asp.general:
Below in GOOD CODE, I have a mix of ASP/HTML that works. I'm trying to
convert the code into all ASP, but I'm failing in BAD CODE. Can
someone help me with these quotes? The single quotes are very hard to
master.
BAD CODE:

sHTML=sHTML & "bgcolor=" & tblcolor & style=""cursor:default;""
onMouseOver="this.bgColor=""'#e6e6e6'"" onMouseOut="this.bgColor='" &
tblcolor & "'"

sHTML=sHTML & "bgcolor=' " & tblcolor & " ' "
sHTML=sHTML & "style='cursor:default;' "
sHTML=sHTML & "onMouseOver='this.bgColor=#e6e6e6' "
sHTML=sHTML & "onMouseOut='this.bgColor=\' " & tblcolor & " \'' "
However I would define the colour in style too:
sHTML=sHTML & "style='cursor:default;background-color:" & tblcolor & ";' "
sHTML=sHTML & "onMouseOver='this.style.backgroundColor=#e6e6 e6' "
sHTML=sHTML & "onMouseOut='this.style.backgroundColor=\' "
sHTML=sHTML & tblcolor & " \'' "

Not tested.

You should test this by view-sourcing the clientside"in-browser" result.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Aug 21 '05 #3
I'm getting better at double quotes, but this is confusing because I'm not
sure about js event syntax. I've tried everything and just get errors.

MY CODE:

Response.Write "bgcolor=" & tblcolor & style=""cursor:default;""
onMouseOver="this.bgColor=""'#e6e6e6'"" onMouseOut="this.bgColor='" &
tblcolor & "'"

HTML RESULTS:

bgcolor="whitesmoke" style="cursor:default;"
onMouseOver="this.bgColor='#e6e6e6'" onMouseOut="this.bgColor='whitesmoke'"


"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
scott wrote:
Below in GOOD CODE, I have a mix of ASP/HTML that works. I'm trying to
convert the code into all ASP, but I'm failing in BAD CODE. Can
someone help me with these quotes? The single quotes are very hard to
master.


Look, to escape a quote, double it up:

Response.write "here is a literal quote: "" - see?"

Until you get the hang of it, don't try to do it all at once. Start with
the string fragments:

sHTML= "bgcolor="
response.write sHTML

Running this should result in:
bgcolor=

Now you want an opening quote, so change it to:
sHTML= "bgcolor="""
response.write sHTML

Running it should result in
bgcolor="

Now add the variable:

sHTML= "bgcolor=" & tblcolor

Test it.
Add the closing quote:

sHTML= "bgcolor=" & tblcolor & """"

Test it.
Now add the word "style=":

sHTML= "bgcolor=" & tblcolor & """ style="

Again, test it.
Add the opening quote:
sHTML= "bgcolor=" & tblcolor & """ style="""

Keep going ...

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Aug 21 '05 #4
thanks. what does the \ mean? i haven't seen that symbol used with this type
of syntax before.

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
scott wrote on 21 aug 2005 in microsoft.public.inetserver.asp.general:
Below in GOOD CODE, I have a mix of ASP/HTML that works. I'm trying to
convert the code into all ASP, but I'm failing in BAD CODE. Can
someone help me with these quotes? The single quotes are very hard to
master.
BAD CODE:

sHTML=sHTML & "bgcolor=" & tblcolor & style=""cursor:default;""
onMouseOver="this.bgColor=""'#e6e6e6'"" onMouseOut="this.bgColor='" &
tblcolor & "'"

sHTML=sHTML & "bgcolor=' " & tblcolor & " ' "
sHTML=sHTML & "style='cursor:default;' "
sHTML=sHTML & "onMouseOver='this.bgColor=#e6e6e6' "
sHTML=sHTML & "onMouseOut='this.bgColor=\' " & tblcolor & " \'' "
However I would define the colour in style too:
sHTML=sHTML & "style='cursor:default;background-color:" & tblcolor & ";' "
sHTML=sHTML & "onMouseOver='this.style.backgroundColor=#e6e6 e6' "
sHTML=sHTML & "onMouseOut='this.style.backgroundColor=\' "
sHTML=sHTML & tblcolor & " \'' "

Not tested.

You should test this by view-sourcing the clientside"in-browser" result.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Aug 21 '05 #5
scott wrote:
thanks. what does the \ mean? i haven't seen that symbol used with
this type of syntax before.

In vbscript, you tell te compiler to ignore what a character usually means
("escaping " it) by doubling it. In jscript, you escape a character by
preceding it with a backslash.

Your confusion is arising because you are using vbscript to generate strings
that will be interpreted by the jscript engine.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 22 '05 #6
What errors? This result looks correct to me ... Oh, does HTML RESULTS
contain what you want the results to be? Your code would not return those
results ...

I would have used the style property instead of the deprecated bgColor. Try
this:

Response.Write "style=""cursor:default; background-color:" & _
tblcolor & """ onMouseOver=""this.style.backgroundColor='" & _
"#e6e6e6'"" onMouseOut=""this.style.backgroundColor='" & _
tblcolor & "'"""
scott wrote:
I'm getting better at double quotes, but this is confusing because
I'm not sure about js event syntax. I've tried everything and just
get errors.
MY CODE:

Response.Write "bgcolor=" & tblcolor & style=""cursor:default;""
onMouseOver="this.bgColor=""'#e6e6e6'"" onMouseOut="this.bgColor='" &
tblcolor & "'"

HTML RESULTS:

bgcolor="whitesmoke" style="cursor:default;"
onMouseOver="this.bgColor='#e6e6e6'"
onMouseOut="this.bgColor='whitesmoke'"

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
scott wrote:
Below in GOOD CODE, I have a mix of ASP/HTML that works. I'm trying
to convert the code into all ASP, but I'm failing in BAD CODE. Can
someone help me with these quotes? The single quotes are very hard
to master.


Look, to escape a quote, double it up:

Response.write "here is a literal quote: "" - see?"

Until you get the hang of it, don't try to do it all at once. Start
with the string fragments:

sHTML= "bgcolor="
response.write sHTML

Running this should result in:
bgcolor=

Now you want an opening quote, so change it to:
sHTML= "bgcolor="""
response.write sHTML

Running it should result in
bgcolor="

Now add the variable:

sHTML= "bgcolor=" & tblcolor

Test it.
Add the closing quote:

sHTML= "bgcolor=" & tblcolor & """"

Test it.
Now add the word "style=":

sHTML= "bgcolor=" & tblcolor & """ style="

Again, test it.
Add the opening quote:
sHTML= "bgcolor=" & tblcolor & """ style="""

Keep going ...

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Martin Goldman | last post by:
Hello all, I've been struggling for a few days with the question of how to convert "smart" (curly) quotes into straight quotes. I tried playing with the htmlentities() function, but all that is...
6
by: Cyrus D. | last post by:
Hi guys, I haven't done that much research on this topic but it seems I can use either the single quotes or the double quotes. SInce I am so used to C(++) I prefer the double quotes and am...
11
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into...
4
by: Gerald Aichholzer | last post by:
Hello, I need to specify the following attribute in an xhtml-file containing TAL templates: <div tal:attributes="onMouseOver concat('func(',xyz,')')"> which results in <div...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
4
by: (PeteCresswell) | last post by:
Is his just a flat-out "No-No" or is there some workaround when it comes time for SQL searches and DAO.FindFirsts against fields containing same? I can see maybe wrapping the value searched for...
7
by: gar | last post by:
Hi, I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code text= Replace(text, """", "'" This works fine (for normal double quotes).The problem...
3
by: Balaskas Evaggelos | last post by:
Hi to all, I am developing a php web browser application. But i have a problem. I am listing with opendir but there are a lot of files with quotes in their names. example: News Letter...
4
by: Michael Yanowitz | last post by:
Hello: If I have a long string (such as a Python file). I search for a sub-string in that string and find it. Is there a way to determine if that found sub-string is inside single-quotes or...
5
by: Brigitte Behrmann | last post by:
Please can some-one help, I cannot get this to work. <html> <head> <title>Random Proverbs</title> <script type="text/javascript"> <!-- HIDE FROM INCOMPATIBLE BROWSERS function changeQuote() {...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.