473,748 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing " in asp instead of ""

229 New Member
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in "" instead of "" otherwise I get an error message.

Can anyone suggest how to write it so that it writes " instead of "".
I have tried all combinations of adding " to the code but as soon as I think I am there I get throw out again.

Expand|Select|Wrap|Line Numbers
  1. if CurrentRatio > TargetRatio then ' We'll scale height
  2. strResize = "width=""" & intDesiredWidth & """"
  3. else
  4. strResize = "height=""" & intDesiredHeight & """" ' We'll scale width
  5. end if
  6. else
  7. strResize = ""
  8. end if
  9.  
  10. ImageResize = strResize


I got to this point and it wrote the "to the page but kept the inner "", when I took them out I got asp errors again.

Expand|Select|Wrap|Line Numbers
  1. strResize = "height= " """ & intDesiredHeight & """"" ' We'll scale width
  2. end if
  3. else
  4. strResize = ""
  5. end if
Is there a function that could tell it to write the " differently.
Any help would be great before I pull my hair out!
Thanks
Richard
Mar 3 '08 #1
4 3893
DrBunchman
979 Recognized Expert Contributor
Hi Richard,

You could use a different set of chars to represent the quote marks. Try something like the following which uses &qt instead:

Expand|Select|Wrap|Line Numbers
  1.  
  2. if CurrentRatio > TargetRatio then ' We'll scale height
  3. strResize = "width=&qt" & intDesiredWidth & "&qt"
  4. else 
  5. strResize = "height=&qt" & intDesiredHeight & "&qt" ' We'll scale width
  6. end if
  7. else
  8. strResize = ""
  9. end if
  10.  
  11. ImageResize = strResize
  12.  
Then when you've passed this variable to your javascript code you can replace all the &qt's with double quote's.

Let me know if this helps,

Dr B
Mar 3 '08 #2
fran7
229 New Member
Dear Dr B, Thanks, The way you wrote out the quotes made it work perfectly, I didnt even have to change the method just the position. Thanks for that.

The only trouble is that solving that one has revealed another problem. As I am calling the script twice it resizes one image and not the other. One reduces to 1pixel in width and height. Although I look at the scource code and it writes the width correctly it does not display correctly which seems strange! I have tried repeating the image resize function with different names but to no avail. Would you have any ideas, if it can be called twice etc?
Thanks again
Richard
Mar 3 '08 #3
fran7
229 New Member
Dear Db, A bit of perseverance and I got there. I missed that the second instance wasnt in a javascript function so needed the "" instead of    so I just wrote the function again with a unique name as it was originally and it solved the problem.
Thanks for your help
Richard
Mar 3 '08 #4
markrawlingson
346 Recognized Expert Contributor
Just some general input:

I have a function I use for this.

Expand|Select|Wrap|Line Numbers
  1. Function Quote( sTemp )
  2.    Quote = Chr( 34 ) & sTemp & Chr( 34 )
  3. End Function
  4. 'And called like so...
  5.  
  6. sSomeString = "<input type=" & Quote( "text" ) & ">"
  7.  
Makes it nice and simple :)


Dear Db, A bit of perseverance and I got there. I missed that the second instance wasnt in a javascript function so needed the "" instead of &nbsp;&nbsp; so I just wrote the function again with a unique name as it was originally and it solved the problem.
Thanks for your help
Richard
Mar 4 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
8065
by: David Furey | last post by:
Hi I have an XML documnet and a XSLT document as shown below THe XSLT document brings back a filtered docmument that has the VendorName that starts with a particular sub-string This works as expected with alphabet and number characters and the ' (single quote &apos; entity) character but does not work if a double quote character " is part of the string to filter on This returns all Vendor Names that begin with A (either case)
4
14802
by: barney | last post by:
Hello, I' m using .NET System.Xml.XmlDOcument. When I do the following: XmlDocument xml = new XmlDocument(); xml.Load("blah"); .... xml.Save("blub"); I've got the problem that the following expression: .... snip ...
5
3445
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this <Addresses> <Address>&qout;Somebody's Name&quot; &lt;me@mydomain.com&gt;</Address> </Addresses>
3
3582
by: DC Gringo | last post by:
I have an image control (that pulls an image off an ESRI map server): <ASP:IMAGE ID="imgZonedCountry" RUNAT="server"></ASP:IMAGE> In the code behind I am setting the ImageURL to a String value with url parameters like this: imgZonedCountry.ImageUrl = "http://server/servlet/com.esri.wms.Esrimap?param1=x&param2=y When it serves up the page, I'm getting "&amp;" in place of the "&"
7
2806
by: DC Gringo | last post by:
I am having a bear of a time with setting a URL query string as a text value in a dropdownlist and Server.URLEncode does not seem to do its job. theFullLink = theLinkPrefix & theImageryTypeTrimmed & Server.URLEncode("&f=") ddlMyDropDownList.Items.Add(New ListItem("MyTextValue", theFullLink & "af")) Which puts out the following HTML: <option value="~/folder/page.aspx?param1=value1%26f%3daf">-
14
5934
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only because of this, so I hope some of you gurus can enlighten me with this :) In what circumstances can the "&amp;" in the source code be involuntary changed to "&" by a browser when or other software, when editing and uploading the file to the web...
3
3099
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn =server.createobject("ADODB.connection") objConn.open "DSN=Photo" Dim sqlSELsite,ObjRSSel sqlSELsite = "SELECT Name FROM tblbwday WHERE B'day ="& date() &" " '
13
2803
by: Ragnar | last post by:
Hi, 2 issues left with my tidy-work: 1) Tidy transforms a "&amp;" in the source-xml into a "&" in the tidied version. My XML-Importer cannot handle it 2) in a long <title>-string a wrap is produced like: <title>my very long title blab la blab la Blabla bla </title> Importer also has got problems with it
1
1601
by: Amith | last post by:
Here we are facing a problem which is when we pass a parameter to javascript putting '&' . Ex: &contact. In Japanese OS when we receive this parameter in the script '&' is converted to 'e'.So script is not recognizing the same. In english OS this working fine. Do anyone have any idea.........................
0
8994
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9250
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4878
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.