Total members 11895 |It is currently Tue Dec 03, 2024 6:41 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





In this example we show how to write double quotes to the web page in asp, we need special handling when displaying double quotes, following is some cases on how to print double quotes:
1- Using
Code:
Response.Write """

Print: "
2- Using
Code:
Response.Write chr(34)

Print: "
3- To display quotes with strings :
Code:
Response.Write " string1 ""string2 string3 """

Print: string1 "string2 string3"

You can also use single quotes instead of double quotes to define the strings and avoid the need for escaping the quotes. Response.Write 'string1 "string2" "string3"' . This will also output the following string:
string1 "string2" "string3"



4- Writing quotes in HTML codes
Code:
Response.Write " <img src= ""image.gif""  />"

Print : <img src= "image.gif" />

The code uses double quotes to define a string containing the HTML image tag. Within the image tag, the "src" attribute is used to specify the source of the image, which is "image.gif". However, the way the code is written will result in an error. Because the attribute value of "src" is also enclosed in double quotes, the interpreter will consider the rest of the code as part of the attribute value. To correct this, you can escape the inner double quotes using a backslash (). Like this:

Response.Write " <img src= "image.gif" />"

Or you can use single quotes instead of double quotes to define the attribute value. Like this:

Response.Write " <img src='image.gif' />"

Both of the above-corrected codes will output the following HTML:

<img src='image.gif'>

In summary, this code snippet is trying to output an HTML image tag that displays an image named "image.gif". However, the way the code is written will result in an error because of the conflicting double quotes, but it could be fixed by either escaping the inner double quotes or using single quotes instead.



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : displaying double quotes in ASP
 Add double quotes to text dynamically, on page load     -  
 usage of <q> and <blockquote> to add quotes to your HTML     -  
 Displaying Images using servlets     -  
 Displaying Images in a Gallery     -  
 displaying alert box in html     -  
 ASP.NET code for filling and displaying a DataGrid     -  
 Displaying images from database instead of the url from data     -  
 PHP forum- images displaying as codes     -  
 images,videos and signatures displaying as codes     -  
 double value be cast to a byte     -  



Topic Tags

ASP Strings, ASP Basics






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com