473,487 Members | 2,674 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

help with quotes, please...

I have this

<img src="a.jpg" onClick=this.src="b.jpg\"">

and it works. But I like obeying rules so I change it to

<img src="a.jpg" onClick="this.src=\"b.jpg\"">

and it no longer works.

Please note that I really cannot do the alternating
single-quote-double-quote thing is the onClick action is set programatically
and it is hard to detect exactly what's inside.

Thanks!

Aaron Fude
Jul 23 '05 #1
3 2006
Aaron Fude wrote on 27 okt 2004 in comp.lang.javascript:
I have this

<img src="a.jpg" onClick=this.src="b.jpg\"">

and it works. But I like obeying rules so I change it to

<img src="a.jpg" onClick="this.src=\"b.jpg\"">

and it no longer works.
<img src="a.jpg" onClick="this.src=b.jpg;">

as long as you do not use spaces in the second jpg name

======== or =======

<script>
function myB(x){ x.src="b with spaces.jpg"};
</script>

<img src="a.jpg" onClick="myB(this);">

====================
Please note that I really cannot do the alternating
single-quote-double-quote thing is[as?] the onClick action is set
programatically and it is hard to detect exactly what's inside.


That does not seem a valid statement, if you can enter \" you can enter
an apostrophe/single quote programmatically too.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 23 '05 #2
On 27 Oct 2004 08:21:25 GMT, Evertjan. <ex**************@interxnl.net>
wrote:
Aaron Fude wrote on 27 okt 2004 in comp.lang.javascript:
I have this

<img src="a.jpg" onClick=this.src="b.jpg\"">

and it works. But I like obeying rules so I change it to

<img src="a.jpg" onClick="this.src=\"b.jpg\"">

and it no longer works.
It wouldn't. HTML doesn't respect backslash as an escape character. It
literally sees \" and interprets it as the end of the attribute. Either
you use single quotes, or the &quot; entity reference.
<img src="a.jpg" onClick="this.src=b.jpg;">


But that wouldn't work, would it. It would be interpreted as: "assign the
value of property jpg of object b, to property src of the current object
(represented by this)". You would have to quote the string.

[snip]
Please note that I really cannot do the alternating
single-quote-double-quote thing is[as?] the onClick action is set
programatically and it is hard to detect exactly what's inside.


That does not seem a valid statement, [...]


I agree.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3
Michael Winter wrote on 27 okt 2004 in comp.lang.javascript:
<img src="a.jpg" onClick="this.src=b.jpg;">


But that wouldn't work, would it. It would be interpreted as: "assign
the value of property jpg of object b, to property src of the current
object (represented by this)". You would have to quote the string.


Yyyyyyyyyyyyyyyes.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 23 '05 #4

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

Similar topics

3
3252
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
6
2555
by: Allan | last post by:
Please help, below is my problem. Let's say I have 2 tables, a Products table and a Colors table that go as follow: Table Products prodID Name 1 shirt 2 tshirt
2
2783
by: Goran Petrovic | last post by:
I wrote a vb function, but i need it i jaavscript..i know java sintax but am not sure how to make it work. this extracts teh file name from a path...i thought strcpy..or something..but dont really...
8
5448
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
2459
by: Tony Ciconte | last post by:
I am using Acc97 and trying to get the following instruction to work in the OnOpen event of a report: DLookup("", "tblTempRevenueByFY", DatePart("m", ) = 1) The table tblTempRevenueByFY...
9
371
by: Bob Dankert | last post by:
I am trying to create a regular expression to split a string at each newline, unless the newline is within a set of quotes. Unfortunately, I have little experience with Regular Expressions and...
6
4773
by: Dave | last post by:
I'm struggling with something that should be fairly simple. I just don't know the regext syntax very well, unfortunately. I'd like to parse words out of what is basically a boolean search...
4
3189
by: JS | last post by:
I am writing a C# app that needs to parse a sentence entered by the user for a simple boolean search. I need to capture all of the AND words that are not inside of double quotes. However, I am...
1
3692
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
83
7707
by: deppy_3 | last post by:
Hi.I am started learning Programm language C before some time.I am trying to make a programm about a very simple "sell shop".This programm hasn't got any compile problem but when i run it i face...
0
7106
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
6967
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
7137
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
7181
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
7349
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
4565
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
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
600
muto222
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.