如何在另一个JavaScript函数中调用一个JavaScript函数?

时间:2013-08-24 09:38:07

标签: javascript

function rblSelectedValue() {

    var radio = document.getElementsByName('rblInterview');
    for (var i = 0; i < radio.length; i++) {
        if (radio[i].checked == true) {
            // document.getElementById('txt1').value = radio[i].value;

            var value1 = radio[i].value
            var radio1 = document.getElementsByName('rblPrefBatch');
            radio1[i].value = value1;
            radio1[i].checked = true;
            // alert(radio[i].value);

        }

    }

}

function ForNext(ctrlid) 
{
    var DdlYear = document.getElementById("<%= DdlYear.ClientID %>")

    if (document.getElementById(ctrlid).checked)
         {

            document.getElementById('<%=PanelView.ClientID %>').style.visibility = 'visible';
            // rblSelectedValue();
            document.getElementById('<%=txtpreYearofAppearing.ClientID%>').value = document.getElementById('<%=txtYearofAppearing.ClientID%>').value;
            document.getElementById('<%=txtpreupscrollno.ClientID%>').value = document.getElementById('<%=txtRollno.ClientID%>').value;
            document.getElementById('<%=txtaddidpre.ClientID%>').value = document.getElementById('<%=txtAddID.ClientID%>').value;
            document.getElementById('<%=txtaddyearpre.ClientID%>').value = document.getElementById('<%=DdlYear.ClientID%>').value;
            document.getElementById('<%=txtpreNoOfAttempt2009.ClientID%>').value = document.getElementById('<%=txtNoOfPrevAttempts.ClientID%>').value;
            document.getElementById('<%=txtPrePrelim.ClientID%>').value = document.getElementById('<%=txtPrelimi.ClientID%>').value;
            document.getElementById('<%=txtpremain.ClientID%>').value = document.getElementById('<%=txtMain.ClientID%>').value;
            document.getElementById('<%=txtpregs.ClientID%>').value = document.getElementById('<%=txtGS.ClientID%>').value;
            document.getElementById('<%=txtpreopt.ClientID%>').value = document.getElementById('<%=txtOptional.ClientID%>').value;
            document.getElementById('<%=rblPreint.ClientID%>').value = document.getElementById('<%=rblInterview.ClientID%>').value;
            document.getElementById('<%=txtpreother.ClientID%>').value = document.getElementById('<%=txtCorseothers.ClientID%>').value;

        }
        else 
        {
            document.getElementById('<%=PanelView.ClientID %>').style.visibility = 'hidden';

        }
    } 

2 个答案:

答案 0 :(得分:0)

它是一个简单的函数调用,如

rblSelectedValue();

但只是在html页面中包含两个javascript文件。

答案 1 :(得分:0)

function one(){
//code
}

function two(){
//more code
one(); //calling function "one"
}