Click to See Complete Forum and Search --> : Confusing Quotes


anarchist
05-07-2003, 07:28 AM
Just to be different I'm writeing a page that uses javascript to dynamically create parts of itself, the problem I am having is that I need to generate code that contains an event, javascript generating javascript

what I have is
s="<tag onclick='function(" + anotherfunction() +")'>"

the problem is that anotherfunction returns a string which needs to be quoted so that function can use it
I've tried using a \" arround it, but got an invalid character
is there a way of doing what I need?

khalidali63
05-07-2003, 08:07 AM
question is somewhat vague,I am sure you can use this

s="<tag onclick='function(\'" + anotherfunction() +"\')'>";

Vladdy
05-07-2003, 08:19 AM
correct way of accomplishing the task is to use
document.createElement for element creation and
node.addEventListener (or node.attachEvent in damn IE) for adding event processing function.

anarchist
05-07-2003, 08:49 AM
thanks for the tips, think Khalids, methods easiest