Passing input parameter to external js file function
-
Hi, I have written the following function in external JScript.js file. function validateParameter(textBoxId) { var paramname = document.getElementById(textBoxId); alert(paramname); } Text="Save Comments" OnClientClick="javascript: return validateParameter('<%=txtParam.ClientID %>');"> But during the runtime it showing the alert message as null. How to pass the input parameter to the function which in external javascript file. Tnks in advance!
-
Hi, I have written the following function in external JScript.js file. function validateParameter(textBoxId) { var paramname = document.getElementById(textBoxId); alert(paramname); } Text="Save Comments" OnClientClick="javascript: return validateParameter('<%=txtParam.ClientID %>');"> But during the runtime it showing the alert message as null. How to pass the input parameter to the function which in external javascript file. Tnks in advance!
Can you try adding the javascript in your code behind? OnPageLoad do btnSaveCom.attributes.add("onclick", return validateParameter('" + txtParam.ClientID + "');"); If you need to. You can create a second javascript method right in your aspx page. for example callValidator(clientId) { var paramname = document.getElementById(clientId); validateParameterWithParamInsteadOfId(paramname); } I didn't get any requirements for the signature
-
Hi, I have written the following function in external JScript.js file. function validateParameter(textBoxId) { var paramname = document.getElementById(textBoxId); alert(paramname); } Text="Save Comments" OnClientClick="javascript: return validateParameter('<%=txtParam.ClientID %>');"> But during the runtime it showing the alert message as null. How to pass the input parameter to the function which in external javascript file. Tnks in advance!
-
Hi, I have written the following function in external JScript.js file. function validateParameter(textBoxId) { var paramname = document.getElementById(textBoxId); alert(paramname); } Text="Save Comments" OnClientClick="javascript: return validateParameter('<%=txtParam.ClientID %>');"> But during the runtime it showing the alert message as null. How to pass the input parameter to the function which in external javascript file. Tnks in advance!
use btnSaveCom.Attributes.Add("OnClick","javascript:return xx('" + btnxx.ClientID + "');"); in the code area. But you cant alert the parname as its an object. write alert(paramname).value instead.:rose:
Abhishek Sur