[SOLVED]: innerHTML'ing a string with function(object) call?
Posted: Mon Jul 03, 2006 10:25 pm
Hi guys,
I have an object that needs to be placed inside a function call on an onclick event, and javascript has to make this all up itself.
Like so:
Surely there's a way to do that? Passing an Id to the object would require, as far as I can see, building a whole Library class system, because the object is stored inside a multidimensional array.
Right now, when trying the code I posted, I get a "missing a ] after element list." error.
- Nathaniel[/syntax]
I have an object that needs to be placed inside a function call on an onclick event, and javascript has to make this all up itself.
Like so:
Code: Select all
document.getElementById('list').innerHTML += '<li><span onclick="aFunction(' + object + ');">La la la.</span></li>';Right now, when trying the code I posted, I get a "missing a ] after element list." error.
- Nathaniel[/syntax]