Click to See Complete Forum and Search --> : function call another function


tiger66
07-02-2003, 04:36 PM
Hello
I am trying to call a function using HTML's onClick which is in another function

eg.

HTML code:
<div id="agency"> </div>

Javascript code:
function status1(status){
var status1 = document.getElementById("status");
status1.innerHTML = "<td width='6'>\
<input type='radio' NAME='agency' VALUE='Agency' onClick='status2(agency);'></td>\
<td width='194' class='section'>Agency</td>";
}

function status2(agency){
var status2 = document.getElementById("agency");
status2.innerHTML = "Hello"
}

I am not quite sure if the line below cause the problem onClick='status2(agency);'
I've also tried
onClick=" + "status2('agency');"
onClick='status2('agency');'


in HTML I always do
onClick = "status2('agency');"

Help...

Jona
07-02-2003, 04:40 PM
You mean a function calling another function? Like this?


function one(){
alert("One");
two();
}

function two(){
alert("Two");
}


In the above, when function one() is invoked, after it alerts "One," it runs functino two() which alerts, "Two."

[J]ona