
js---随记
bzuld
这个作者很懒,什么都没留下…
展开
-
js随记----将confirm的“确认”“取消”修改成“是”“否”
function text(str) { execScript("n = (msgbox('"+str+"',vbYesNo, '提示')=vbYes)", "vbscript"); return(n); }原创 2011-09-04 20:50:58 · 17044 阅读 · 2 评论 -
js随记----生成动态表格
function insRow() { var x=document.getElementById('myTable').insertRow(0) var y=x.insertCell(0) var z=x.insertCell(1) y.inner原创 2011-10-19 11:13:16 · 543 阅读 · 0 评论 -
js随记----分割字符、截取字符、为下拉列赋值
//分割和截取字符if(str!=""){ while(true) { endidx=str.indexOf(","); if(endidx!=-1) { temp[i++]=str.substring(0,endidx); str=str.substring(endidx+1);//从endidx+1这个位置开始截取 } else原创 2011-10-20 08:56:58 · 847 阅读 · 0 评论 -
js随记----整数与字符串之间的转换、将单选按钮的某项设成不可编辑的
1.js中将整数转换成字符串用toString();2.js中将字符串转换成整数用parseInt();----parseInt("123");3将单选按钮的某个值设成可编辑和不可编辑的 document.forms[0].FDzhongda[0].disabled=true; document.forms[0].FDzhongda[1].disabled=false; 注:F原创 2011-10-20 09:01:12 · 954 阅读 · 0 评论 -
js随记-----生成excel文件
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/1999/xhtml"> WEB页面导出为EXCEL文档的方法 WEB页面导出为EXCEL文档的方法转载 2011-10-20 11:16:34 · 689 阅读 · 0 评论 -
js随记----对下拉列的操作(取下拉列共包含几项、所选的项的索引、所选的项的value和text值
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/1999/xhtml">function test(sel){ var len=sel.length;// 得到下拉列共多少项 var selectedIndex=sel.selectedIndex;//得到选择的项的索引原创 2011-10-20 09:05:00 · 604 阅读 · 0 评论 -
js随记----得到该文档的父文档中的属性
1. 通过document.****.****可以得到该文档的一些属性2.通过opener.document.***.****可以得到该文档的父文档的一些属性原创 2011-10-25 13:26:17 · 440 阅读 · 0 评论 -
通过js实现将所当页的checkbox全选 并且获取其value值
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> //将所有的checkbox全部选中function checkedAll(){ var objs = document.getElementsByTagName("input原创 2012-11-08 10:30:32 · 4683 阅读 · 1 评论 -
js中实现jsp中的basePath
var local = window.location; var contextPath = local.pathname.split("/")[1]; var basePath = local.protocol+"//"+local.host+"/"+contextPath;原创 2013-07-05 14:16:21 · 5350 阅读 · 0 评论 -
js随记----如何将文本框设置成不可编辑的
document.getElementById('textarea的ID').disabled = true;记住:别将true写成“true”原创 2011-10-19 11:11:29 · 31558 阅读 · 4 评论 -
js随记---js中substring()和substr的区别
substring 方法用于提取字符串中介于两个指定下标之间的字符substring(start,end)开始和结束的位置,从零开始的索引参数 描述start 必需。一个非负的整数,规定要提取的子串的第一个字符在 stringObject 中的位置转载 2011-10-19 10:19:30 · 640 阅读 · 0 评论 -
工作中js随记
1、url可以通过location.href得到;2、http://hao123.com/weboa/formname?openform&unid=1234567 若想得到unid=1234567: url.substring(url.indexOf("&")原创 2011-08-18 09:16:03 · 405 阅读 · 0 评论 -
定位html标签的几种方法
1、document.getElementById("id").nodeName; 2、document.getElementsByName("a1").item(0).nodeName3、document.getElementsByName("a1")[0].nod原创 2011-08-02 15:56:03 · 4347 阅读 · 0 评论 -
关于document.all.item()
1、 document.all.item()是通过元素的name和id来得到名字;document.all.item("button01") 可以得到该button按钮2、document.all.button1和document.all.item("button01原创 2011-08-02 11:52:30 · 2787 阅读 · 0 评论 -
html dom 中removeChild(node)
用途:通过父节点来删除指定的子节点 function getNodeValue(){//alert("11111111");var nv=document.getElementById("td1");var nn=nv.parentNode.r原创 2011-07-22 14:52:11 · 1815 阅读 · 0 评论 -
关于nodeValue以及其与value的区别
nodeValue就是用来得到“文本元素的值”的,即只适用于“文本节点”;例子:function getNodeValue(){var nv=document.getElementById("td1").firstChild.nodeValue;v原创 2011-07-22 14:33:32 · 4079 阅读 · 0 评论 -
javascript中getElementsByName和getElementById的区别
http://www.w3.org/1999/xhtml">function test(){document.forms[0].button2.click();}function test2(){//document.form1.text1.val原创 2011-07-20 13:51:46 · 2948 阅读 · 0 评论 -
js随记-----js调用style中的样式
*****************************************************************************************************js中调用style中的样式:如style="background-ima原创 2011-08-31 10:19:35 · 1512 阅读 · 0 评论 -
js随记----动态的生成表格
function insRow() { var x=document.getElementById('myTable').insertRow(0) var y=x.insertCell(0) var z=x.insertCell(1) y.inner原创 2011-09-27 09:01:21 · 433 阅读 · 0 评论 -
jsp 页面 获取系统当前日期和时间(钟表功能)
function showtime() { var today;var hour;var second;var minute;var year;var month;var date;var strDate; today=new Date(); var n_day = today.getDay(); switch (n_day) { case原创 2014-08-12 09:07:05 · 2293 阅读 · 0 评论