Link to home
Start Free TrialLog in
Avatar of tjeffryes
tjeffryesFlag for United States of America

asked on

Passing quotes to a function in javascript

I am new at javascript.

I'm wanting to pass numeric and text variables to a function that has 7 parameters.  One of these parameters is generally a fairly verbose piece of text that can contain apostrophes and quotes.

It appears as though when I use onclick=, I need to surround the infomration in quotes.  that's fine except in my largest parameter there is need for many quotes.  In the example shown I've used "xxx" for quotes and then my function replaces "xxx" with quotes. However, I'd rather be able to pass regualr quotes or something more identifiable as quotes so that other users can use this function.

The idea of this code is to allow user to click on an image and the onclick event fires a function that opens a popup.


<a href="#" onclick="return false" style="text-decoration: none">
<img src="images/bw_palms_drop_mini.jpg" width="158" height="105"
alt="bw_palms_drop_mini.jpg" border="0" onclick="picwin2(450,550, 'Car Unveiling Party', 'Car Unveiling Party', '../images/bw_palms_drop.jpg',
          	'$1,200', 
          	'This xxxnew year\'s eve partyxxx was actually staged in October at the car dealership for a xxxNew Model Yearxxx unveiling.  Palm trees with lights ' + 
          	'($350 each) and a classic balloon drop made this party elegantly festive.  At xxxmidnightxxx (okay, 8:30 pm), we had a balloon drop, confetti launch ' + 
          	'and unveiled the xxxNew Modelxxx car!')"></a>

Open in new window

Avatar of Big Monty
Big Monty
Flag of United States of America image

i BELIEVE you can just double up the double quotes:

onclick="picwin2(450,550, 'Car Unveiling Party', 'Car Unveiling Party', '../images/bw_palms_drop.jpg',
                '$1,200',
                'This ""new year\'s eve party"" .....')
Avatar of tjeffryes

ASKER

Big Daddy:

This did not work.  Thanks for trying.  

I'm attaching a simpler version of what I'm trying to try and remove the complexity.  I've tried using href="javascript:picwin2()" and onclick="picwin2()" and the results are the same.

I did find the sending &quot works.  That's nice to know and may be the only solution.  however, I'd love to be able to write text in "english" so it would be easy for a non-programmer to use the function.


<a href="javascript:picwin2(450,700,	'Exploding Balloon Tower', 'Exploding Balloon Tower', '../images/column_exploder.jpg', '$200','here is text that has "quotes" in it')"><img src="images/column_exploder_mini.jpg" width="116" height="181"alt="column_exploder_mini.jpg" border="0"></a>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Toms Edison
Toms Edison
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial