Hi, 1. How do you set up your first s,t,c? 2. Where does cod come from? 3. I suppose s and c should be strings. Then you would have to escape the strings in the onClick function call: "<a href='#' onClick='test(\""+s+"\", 0, \""+c+"\")'>-</a>"
by(e) Stephan 2009/2/10 Po01 <diogoapa...@gmail.com>: > > Hi, i have a function like this: > function test(s, t, c) > { > var Ss = "#" + s; > var S = "#" + s + cod; > if(t == 1) > { > $(S).empty().html("<a href='#' onClick='test("+s+", 0, "+c+")'>-</ > a> "+s); > $(Ss).show(); > } > else > { > $(S).empty().html("<a href='#' onClick='test("+s+", 1, "+c+")'>+</ > a> "+s); > $(Ss).hide(); > } > } > > Can you guys understand what im trying to do... I wanna generate the > HTML with the same function but with some changes, i can do all, but i > dont know why the "+s+" doesnt work. theres no value, i tried to use > an alert for "s" and it says object, so the function only work first > time when i load the page, i think its something wrong with the > format: > $(S).empty().html("<a href='#' onClick='test("+s+", 0, "+c+")'>-</ > a> "+s); > $(S).empty().html("<a href='#' onClick='test("+s+", 1, "+c+")'>+</ > a> "+s); >