I have around 10 to 12 functions in JavaScript. I want to call 2 or 3 of them in the event when control, get, focus, and other functions I used by those functions.
I have all those functions for virtual keypad ... I would like to add virtual keypad as on the master page (I have already created virtual keypad in JavaScript using HTML form).
I have already added that code into a master page and my keypad is working, but it only works with simple HTML controls (that is, having no runat="server" attribute). It doesn't work when I add runat="server".
I don't know how to call this functions from content or child pages.
My code is below:-- (this code for JavaScript that i added in master page...this is part of code(not full))
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage2.master.cs" Inherits="MasterPage2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function setId(el) {
id = el;
//alert(el);
document.getElementById(id).focus();
reset();
return 0;
}
function restoreCode(evt) {
ButtonUp(kcode);
}
function writeKeyPressed(evt) {
InsertChar('k', kcode);
return false;
};
function InsertChar(mode, c) {
document.getElementById(id).focus();
}
function ButtonDown(c) {
reset();
}
function ButtonUp(c) {
//codes
resets();
}
function Shift() {
//codes
}
</script>
When I am calling it from content page that is HTML control not having runat="server" attribute in code then it will work.
<input id="txt_pwd" type="password" onfocus="setId('txt_pwd');" />
When I am calling it from content page (that is, an ASP control having runat="server" attribute in code) then it will not work.
<input id="txt_pwd" type="password" onfocus="setId('txt_pwd');" runat="server" />
Please can any one tell me a solution that I will call my function (having on the master page) using server side control from content page.