sending id to js function

webmasterbeta

New Member
Hi all i am using this function for open/close folder

function NodeProcessing(divNum,TmpId){

if (divNum == 0)
{
var txt = document.getElementById('a2').innerHTML


document.getElementById('a2').innerHTML = (txt=='Show All Sub') ? "Hide All Sub" : "Show All Sub"
}

and when i am calling this function by:

<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onclick="NodeProcessingYanuv(0,{generate-id(.)})" id="a2">Show All Sub</a>

this static code works fine but when ever i try to change the code to a dynamic way like that :

function NodeProcessingYanuv(divNum,TmpId){
if (divNum == 0)
{
var txt = document.getElementById(TmpId).innerHTML
document.getElementById(TmpId).innerHTML = (txt=='Show All Sub') ? "Hide All Sub" : "Show All Sub"
}

and i an calling this function by:

<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onclick="NodeProcessingYanuv(0,{generate-id(.)})" id="{generate-id(.)}">Show All Sub</a>

It is not working, and the debbuger say that an object is needed

way the id="{generate-id(.)}" dont work like id="a0"> ?

can anyone help please ?
 
Top