Quotation mark problem

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 12
Joined: Mon Jul 21, 2003 1:09 am

Mon Sep 01, 2003 12:29 am

I have problem about the quotation marks!!! it really annoys me!!

<a href="#" onClick="javascript:popup_window('javascript:document.write(&quot;<a href=" sp13.bmp"><img src=sp13.bmp></a&quot;);',500,400);return false;">

The Green color quot should be a pair but.... the Red color one cut i off!!! so It is read as wrong language!!!

but if I remove the quot as <a href=sp13.bmp> and it won't works...

is it possible to use other punctuation to replace it????

User avatar
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Mon Sep 01, 2003 1:02 am

The quotes in Javascript are to be used alternatively to make Javascript understand that they are quotation marks

Code: Select all

onClick = "document.write('This is in single quotation marks')";

Please put your code in the code tag of the forum to help understand better

php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Mon Sep 01, 2003 6:17 am

are you using any web development tool to this javascript to embed in html :?:

User avatar
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Mon Sep 01, 2003 9:21 am

Just like in PHP, you can escape quotation marks in JavaScript using \.

Also, when using JavaScript in an OnClick event, you don't need to include the "javascript:" declaration. You only need that if you're putting that in the href="" of a link.

Post Reply