473,406 Members | 2,867 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,406 software developers and data experts.

including parameters in innerHTML

Claus Mygind
571 512MB
In the code below I want to include the values of an array that only exist in the function where this code is located. But I get the following error:

missing ; before statement

td.innerHTML = '<input type="button" ...rue,'+aReturn[0]+','+aReturn[1])+';">';\n
As shown in the code below I try to add the values of the array elements by putting them outside the single ' quote delimiter for the innerHTML. I have also tried putting them right in the string, but then the array is not recognized when the button is clicked.

What would be the correct syntax?

Expand|Select|Wrap|Line Numbers
  1.  
  2.  tr = tbody.insertRow(tbody.rows.length);
  3.  td = tr.insertCell(tr.cells.length);
  4.  td.setAttribute("align", "center");
  5.  td.innerHTML = '<input type="button" value="Continue" onclick="showPopSearch();validateUser(true,'+aReturn[0]+','+aReturn[1])+';">';
  6.  
Jan 12 '09 #1
1 3161
Claus Mygind
571 512MB
I see my mistake. the ) is not in the literal string.

Expand|Select|Wrap|Line Numbers
  1. td.innerHTML += '<input type="button" value="Continue" onclick="showPopSearch();validateUser(true,'+aReturn[0]+','+aReturn[1]+');">';
  2.  
Jan 12 '09 #2

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

Similar topics

7
by: Pavils Jurjans | last post by:
Hallo, I have been programming for restricted environments where Internet Explorer is a standard, so I haven't stumbled upon this problem until now, when I need to write a DOM-compatible code. ...
6
by: mr_burns | last post by:
hi, is it possible to have a string variable to contain new lines. i tried the following but it didnt work: var_string = '<h1>Title</h1> <img src="image.gif> <p>Body text</p>'; i know...
3
by: N. Demos | last post by:
How do you dynamically assign a function to an element's event with specific parameters? I know that the code is different for MSIE and Mozilla, and need to know how to do this for both. I...
4
by: RobG | last post by:
I know you aren't supposed to use innerHTML to mess with table structure, but it seems you can't use it just after a table without damaging the containing element. I added a table to a div using...
9
by: Hallvard B Furuseth | last post by:
Why does the FAQ (Q 4.15) recommend innerHTML when so many here say one should use createElement(), replaceChild() etc? Also, why does the "Alternative DynWrite function" at...
1
by: Pablo | last post by:
Dear all, I have a website where I need to fill its contents after retrieving some data from another system (not a DB, but you can think like it). I know the nature of the data, but the order...
6
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to...
2
by: Jonny B | last post by:
Hi all, I'm working on an a clientside xslt using jscript that passes a parameter to the xsl. I've got it working no problem in IE but cant get it to work in Mozilla. Can anyone help? This is...
1
by: aashishn86 | last post by:
i create dynamic rows using this function : function addRow() { var tbl = document.getElementById('applications'); var lastRow = tbl.rows.length; var iteration = lastRow; var row =...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...
0
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...
0
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...
0
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,...

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.