2015/9/1
1.在字符串中没有可以所需要查找的“X”的时候,返回的值
java:lastIndexof -1
js: IndexOf undefined...
2015/9/10
1.js:string.substr(start[,length])
如,selecter.dm = selectIndex.substr(3);tr_1234取到“1234”
2015/9/11
1.iframe.src=url;button的onclick事件后直接跳转?
2.配置环境变量:区分用户、环境
最好用户还是使用administrator的用户,(系统一般是先调用系统,然后调用用户?)《实在不行再用户变量中也设置,此外cmd-set查看参数》
3.WorkBook、JSONObject工具的使用
2015/9/16
1.js中使用的ActiveXObject对象,简单理解:加载外部的程序到IE中
2.SQL语句:cast(12.5 AS int) = 12;用于数据类型的转换
3.httpclient:setParameter(“hh”,122)、.httpsend(url)、
2015/9/18
1.乱码问题:
js:xdata = encodeURI(encodeURI(xdata));
java:fUrl = URLDecoder.decode(URLDecoder.decode(fUrl,"utf-8"),"utf-8");
2015/9/23
1.js中使用的(function(){...})();(function(){...}()),是js立即执行函数的常见写法,在函数后面加个括号就能立即执行。
2.灵活应用js中的eval()方法,eval("var a="+data);取出在调用后台返回的数据。
2015/10/9
js:
1.");
}
]]>
//非IE好像(注意”//“)
//<![CDATA[
function(){
alert("");
}
//]]>
/**
* a < b;
**/
2015/11/10
1.js的addRow类的方法:
function addRow(id) {
var tr = document.getElementById(id + "_Item");
var oCloneNode = tr.cloneNode(true);
var comm = document.getElementById(id);
comm.insertBefore(oCloneNode,tr);
var len = comm.childNodes.length;
var index = len-2;
oCloneNode.id = id + "_Item" + index;
//setElementsId(oCloneNode,index);
oCloneNode.style.display = "block";
}
function setElementsId(obj,index){
var len = obj.childNodes.length;
for(var i = 0;i < len;i++){
var tmp = obj.childNodes[i];
var id = tmp.id
if(id){
tmp.id = id + index;
}
if(!tmp.id && tmp.name){
tmp.id = tmp.name + index;
}
setElementsId(tmp,index);
}
}
3.车牌号验证:js
var re = /^[\u4e00-\u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}$/;
if(!re.test($(ctrlId).value)){
obj.style.display = "block";
obj.innerHTML = infoTip;
}else{
cph_boo = true;
obj.style.display = "none";
}
4.excel导入,自行研究。
2015/11/24
1.此处的src为相对路径,/jq.js为绝对路径
2015/12/2
页面提交form时,刷新的是??
form.submit();并不会触发submit事件,提交给后台
2015/12/15
1.表格显示添加一个单选列
var tableColum=[
["RADIO", "String", "选择", "35", "center", "RADIO"],
["DKEY", "String", "权限代码", "100", "center", ""],
["DVAL", "String", "权限名称", "180", "center", ""]
];
2.返回顶部
2015/12/16
1.去除select其他option
for(var i=1;i<fy2.options.length;){
fy2.removeChild(fy2.options[i]);
}
2.IE与非IE的兼容性问题
if($.browser.msie && $.browser.version <=9){
tmp = obj.childNodes[i];
}else{
tmp = obj.children[i];
}
3.ie:支持innerText和innerHTML
支持tmp.name
not ie:支持innerHTML和textContent
不支持tmp.name,可以用tmp.getAtrribute("name")
4.检测浏览器类型
function judgeBrowser(){
var userAgent = navigator.userAgent;
var isOpera = userAgent.indexOf("Opera") > -1;
var isIE = userAgent.indexOf("compatible") > -1;
var isFF = userAgent.indexOf("Firefox") > -1;
var isSafari = userAgent.indexOf("Safari") > -1;
if(isIE){
var IE5 = IE55 = IE6 = IE7 = IE8 = IE9 = false;
var version = /MSIE\s(\S)/.exec(userAgent)[1];
var fIEVersion = parseFloat(version);
switch(fIEVersion){
case 5.5:
return "IE5.5";
case 6:
return "IE6";
case 7:
return "IE7";
case 8:
return "IE8";
case 9:
return "IE9";
default:
return "IEX"
}
if(isOpera){
return "Opera";
}
if(isFF){
return "Firefox";
}
if(isSafari){
return "Safari";
}
}
}
2015/12/18
1.html nodeType=1(为元素节点)
iType:Integer that receives one of the following values.
1 Element node.
3 Text node.
2016/1/26
1.迭代地为button添加event,使用了attachEvent,但是添加多个事件后顺序随机(但是脚本之家的资料是说逆序执行)
function addEvent(obj,type,eve){//添加事件的id,为什么类型的标签添加,添加什么事件
alert(tid+","+type+","+event)
if(obj){
var len = obj.childNodes.length;
for(var i = 0;i < len;i++){
var tmp = obj.childNodes[i];
if(tmp){
var tp = tmp.tagName;
if(tp == type){
tmp.attachEvent("onclick",eve);
}
addEvent(tmp,type,eve);
}
}
}else{
alert("Obj has problem!")
return;
}
}
2.
var rsRows = document.getElementById("rstable").tBodies[0].rows;
var rowNum = rsRows.length;
var j = 0;
for(var i=0; i<rowNum; i++){
var chk = rsRows[i].cells[this.chk_pos].childNodes[0];
if(chk.type == "checkbox" && chk.checked){
var spmc = rsRows[i].cells[this.spmc_pos].innerText;
returnVal[j] = spmc;
j++;
}
}
window.returnValue = returnVal;
self.close();
3.
Array.prototype.contains = function(key) {
var isSearched = false;
for(var i = 0; i < this.length; i++) {
if(this[i] == key) {
isSearched = true;
break;
} else {
continue;
}
}
return isSearched;
};
Array.prototype.indexOf = function(val){
for(var i=0;i < this.length;i++){
if(this[i] == val){
return i;
}
}
return -1;
}
Array.prototype.remove = function(key){
var index = this.indexOf(key);
if(index > -1){
this.splice(index,1)
}
}
2016/1/28
1.好记性不如烂笔头。
window.history.go(-1);
location.href="home.jsp";
window.open(url);
window.opener.doquery()/.init();
window.close();
2.
2016/2/1(在出问题时,要注意《单词拼错》)
1.取table中点击触发事件的那一行
var currRow = (event.srcElement || event.target).parentNode.parentNode;
currRow.cells[this.lysq_pos/0/1].innerHTML
2.圆角IE6-8不兼容,IE9+兼容,需要下载插件ie-css3.htc
css3:
border-radius:30px;
3.mysql取id最大的记录
select * from bghc_splcmx where id=(select max(id) from bghc_splcmx)
select * from bghc_splcmx order by id desc limit 0,1