473,387 Members | 1,483 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,387 software developers and data experts.

how to encode this line

Claus Mygind
571 512MB
It appears I have run out of delimiters, so there must be a way around this coding problem.

I am creating some dynamic content, into which I want to add a couple of variables. I have tried escaping the " (see below) and also tried the [ ] (not sure if square brackets can be used as delimiters).

So how to code this? And if the suggestion is to do an evaluate, please provide and example.

Expand|Select|Wrap|Line Numbers
  1. td.innerHTML = '<a href="#" onclick = "showDetail(\"'+chkForDay+'\",\"'+chkForDay+'\");">show detail</a> '
  2.  
Jan 27 '09 #1
2 1131
acoder
16,027 Expert Mod 8TB
Either use escaped single quotes (as opposed to the double ones) or use a string (with the quotes) and just include that instead, e.g.
Expand|Select|Wrap|Line Numbers
  1. var str = "'test'";
  2. something.innerHTML = '<a href="#" onclick = "showDetail('+str+');">show detail</a> ';
Jan 27 '09 #2
Claus Mygind
571 512MB
Well as it often seems my problems lay in another location. The parameter that was being stored with the "onclick" event handler was being constantly updated as it cycled through my loop. So I assigned the value to the id of the anchor and was able to resolve my problem

Expand|Select|Wrap|Line Numbers
  1. for ( var employee in aWeeklyTime )
  2. {
  3.    for ( var dayOfWeek in aWeeklyTime[employee] )
  4.    {
  5.      td.innerHTML = '<a href="#" id= "'+employee+'"  onclick = "showDetail(this.id,chkForDay);">show detail</a> '
  6.  
  7.    }
  8. }
  9.  
Jan 27 '09 #3

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

Similar topics

2
by: Francach | last post by:
Hi, I don't know what I'm doing wrong here. I''m using Python 2.4 and py2exe. I get he following error: Traceback (most recent call last): File "notegui.pyc", line 34, in OnClose File...
7
by: erikcw | last post by:
Hi, I'm trying to build a SQL string sql = """INSERT INTO ag ('cid', 'ag', 'test') VALUES(%i, %s, %d)""", (cid, ag, self.data) It raises this error: AttributeError: 'tuple' object has no...
6
by: 7stud | last post by:
s1 = "hello" s2 = s1.encode("utf-8") s1 = "an accented 'e': \xc3\xa9" s2 = s1.encode("utf-8") The last line produces the error: --- Traceback (most recent call last):
4
by: J Peyret | last post by:
Well, as usual I am confused by unicode encoding errors. I have a string with problematic characters in it which I'd like to put into a postgresql table. That results in a postgresql error so I...
1
by: anonymous | last post by:
1 Objective to write little programs to help me learn German. See code after numbered comments. //Thanks in advance for any direction or suggestions. tk 2 Want keyboard answer input, for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.