473,770 Members | 5,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Working with quotes and escape sequences

I have to put some html into a variable like so....

var html = '<TABLE cellspacing="5" border="0" .......

But within this html string I also need to have the code for a button
that traps the onclick method like so...

....<input type="button" name="Add Question" value="Repeat Question"
onclick="javasc ript:getQuestio n( '3925','38497', '1' )" >....';

The problem is I am using double quotes for the onclick event and
single quotes for the variables. But I can not use single quotes becuz
the entire html variable is also under single quotes.

I am not sure how I can use escape sequences to help me here. Does
anyone have any suggestions?

Jul 23 '05 #1
1 3593

JehanN...@aol.c om wrote:
I have to put some html into a variable like so....

var html = '<TABLE cellspacing="5" border="0" .......

But within this html string I also need to have the code for a button
that traps the onclick method like so...

...<input type="button" name="Add Question" value="Repeat Question"
onclick="javasc ript:getQuestio n( '3925','38497', '1' )" >....';

The problem is I am using double quotes for the onclick event and
single quotes for the variables. But I can not use single quotes becuz the entire html variable is also under single quotes.

I am not sure how I can use escape sequences to help me here. Does
anyone have any suggestions?


'onclick="getQu estion(\'3925\' ,\'38497\', \'1\')" >';

Those are integers, you could just pass them as such.

'traps the onclick method' is inventive, but what you're doing is
registering an event handling function, assigning it to the onclick
property of that button. You can lose the javascript: (pseudo-)protocol
as well.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8262
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to understand.)
9
2655
by: Dynamo | last post by:
Hi, I am still confused as when to use single or double quotes. This works: echo "<td>" . $row . "</td>"; and this does not
3
5569
by: EdUarDo | last post by:
I think it's a common problem, but I haven't found answers for it. I have a sentence (mixture of HTML, Javascript and JSTL) like this: <a href='javascript:selectItem('${item.code}', '${item.alias}'); ${item.alias} </a> ${item.alias} is a JSTL way to get a String from a parameter that may contains single or double quotes.
9
5855
by: Tom | last post by:
I am working with the this object as oppose to the StreamReader object becuase I need to access a file (to find the contents) while an external application is updating the file. When I was working with the StreamReader object I got a deadlock when I tried reading the file while my external application was writing to it. So far I am able to create a FileStream object and open the file in question (CrawlerBackup.txt). But I am unable to...
3
5725
by: Ken | last post by:
HI: I'm reading a string that will be displayed in a MessageBox from a resource file. The string in the resource file contains escape sequences so they will be broken up into multiple lines. e.g. This is line 1\n\nThis is line 2. When this string is read using a ResourceManager GetString method the string is returned @-quoted, i.e as if I entered the literal @"This is line1\n\nThis is line 2", causing the escape sequences not to be...
12
11755
by: Brett Hofer | last post by:
I must be missing something - Im a veteran C++ programmer now working with C# overall I like the language but find many weird changes... Anyway Im writing code behind an aspx. In this one C# method I am building an XML string to be insterted into a database. This string should result in: <row FIELD1="value1" FIELD2="value2" \> I am using a string type variable and I cannot get the double quotes to be added properly I have tried all of...
4
4280
by: JJ | last post by:
Is there a way of checking that a line with escape sequences in it, has no strings in it (apart from the escape sequences)? i.e. a line with \n\t\t\t\t\t\t\t\r\n would have no string in it a line with \n\t\t\t\thello\t\t\n would hve the string 'hello' in it. In others words, is there a method of removing all escape sequences from a string? I've tried Regex.Unescape(string) but this doesn't not seem to remove the
3
3696
by: bob | last post by:
Hi I have a long regex string that needs to match the quote char. It is matching a CSV text file where all data fields are encased in quotes. Some fields are empty ie double quotes. I want to make sure all fields are correctly formed. Is there any easy way to embed the '"" in the string or do I have to break it up into something like char quote = '"'; string myregex = "\\A" +quote + ",(*)" + quote + "," + quote +",(*)" etc etc.
22
1886
by: tomb | last post by:
I am generating a form dynamically through AJAX. The form and the data come in very nicely, but my reset button doesn't do anything. There are 3 other buttons that call javascript functions - they work fine. Just the reset button seems to be dead. The form is inserted into a Div using AJAX. Here are my form details: <form id="clientform" name="clientform"> <table> <tr> <td>Name:</td>
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
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...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
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...
0
8891
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7420
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
5313
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
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
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

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.