Solved

Passing quotes to a function in javascript

Posted on 2008-10-08
3
771 Views
Last Modified: 2013-11-19
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

0
Comment
Question by:tjeffryes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 22671878
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"" .....')
0
 
LVL 1

Author Comment

by:tjeffryes
ID: 22672054
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

0
 
LVL 13

Accepted Solution

by:
TechTiger007 earned 500 total points
ID: 22672335
Try using &quot;

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

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question