mylibrary.js
来源:互联网 发布:网络摄像头转模拟信号 编辑:程序博客网 时间:2024/06/14 15:30
// Define the namespace
var mylibrary = mylibrary || {};
mylibrary.MyComponent = function (element) {
element.innerHTML =
"<div class='caption'>Hello, world!</div>" +
"<div class='textinput'>Enter a value: " +
"<input type='text' name='value' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8'/>" +
"<input type='button' value='Click'/>" +
"</div>";
// Style it
element.style.border = "thin solid red";
element.style.display = "inline-block";
// Getter and setter for the value property
this.getValue = function () {
return element.
getElementsByTagName("input")[0].value;
};
this.setValue = function (value) {
element.getElementsByTagName("input")[0].value =
value;
};
// Default implementation of the click handler
this.click = function () {
alert("Error: Must implement click() method");
};
// Set up button click
var button = element.getElementsByTagName("input")[1];
var self = this; // Can't use this inside the function
button.onclick = function () {
self.click();
};
// var text = element.getElementsByTagName("input")[0];
// var self = this; // Can't use this inside the function
// text.onkeypress = function (e) {
// e = e || window.event;
// var keycode = e.keyCode;
// if(keycode >= 48 && keycode <= 57){
// e.returnValue = true;
// }else{
// e.returnValue = false;
// }
// }
};
var mylibrary = mylibrary || {};
mylibrary.MyComponent = function (element) {
element.innerHTML =
"<div class='caption'>Hello, world!</div>" +
"<div class='textinput'>Enter a value: " +
"<input type='text' name='value' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8'/>" +
"<input type='button' value='Click'/>" +
"</div>";
// Style it
element.style.border = "thin solid red";
element.style.display = "inline-block";
// Getter and setter for the value property
this.getValue = function () {
return element.
getElementsByTagName("input")[0].value;
};
this.setValue = function (value) {
element.getElementsByTagName("input")[0].value =
value;
};
// Default implementation of the click handler
this.click = function () {
alert("Error: Must implement click() method");
};
// Set up button click
var button = element.getElementsByTagName("input")[1];
var self = this; // Can't use this inside the function
button.onclick = function () {
self.click();
};
// var text = element.getElementsByTagName("input")[0];
// var self = this; // Can't use this inside the function
// text.onkeypress = function (e) {
// e = e || window.event;
// var keycode = e.keyCode;
// if(keycode >= 48 && keycode <= 57){
// e.returnValue = true;
// }else{
// e.returnValue = false;
// }
// }
};
0 0
- mylibrary.js
- mylibrary 研究
- MyLibrary帮助文档
- ListView使用自定义框架mylibrary的基本理解
- WARN [http-8080-1] - No mapping found for HTTP request with URI [/MyLibrary/books/listBooks.action]
- Android studio more than one library with package name 'xxx.xxx.mylibrary'
- 创建静态库第二种方法:在原有工程上操作,打开已存在的工程,然后添加一个要做成.a静态库的 Target 在此,简单命名为mylibrary
- js
- js
- JS
- JS
- JS
- js
- js
- js
- js
- js
- JS
- Express入门
- jquery的格式
- Universal-Image-Loader,android-Volley,Picasso、Fresco和Glide五大Android开源组件加载网络图片的优缺点比较
- 使用Spring配置文件实现AOP
- Android开源项目
- mylibrary.js
- mysql 监控长事务
- 第八周项目1-建立顺序串的算法库
- C语言中do...while(0)的妙用
- 学一点 mysql 双机异地热备份—-快速理解mysql主从,主主备份原理及实践
- Oracle11g,导出时;空表不能导出
- tools:context=".MainActivity的作用
- 安卓截取视频第一帧的方法
- MyVaadinApplication.java