473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

writing " in asp instead of ""

229 100+
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 3854
DrBunchman
979 Expert 512MB
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 100+
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 100+
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 Expert 100+
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
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...
4
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...
5
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;...
3
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...
7
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 &...
14
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...
3
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...
13
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...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.