View Single Post
Old 22-02-2005, 12:30   #9
punky
Inactive
 
Join Date: Jun 2003
Age: 44
Posts: 14,750
punky has a golden aurapunky has a golden aura
punky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aura
Re: Need some Javascript help

Well, if you know the ID you don't need to pass the text in, it is unnesscessary. I tried to fix what you said, but getting the comments1 value outside the function makes javascript throw a hissy fit. It needs a document.getElementById around it anyway. Outside the function, it doesn't work, inside, it does. I can only see that there is a scope issue there somewhere.

I would just do:

HTML section:

Code:
onclick="post_comments(1);
And in the script section:
Code:
function post_comments(id) {

commentpost1= document.getElementById('comments' + id).value;

...
}
Try that, it should work for you. That seems to work for me anyway.
punky is offline   Reply With Quote