文章分类 -  JS

摘要://js获取网站根路径(站点及虚拟目录),获得网站的根目录或虚拟目录的根地址 function getRootPath(){var strFullPath=window.document.location.href;var strPath=window.document.location.pathname;var pos=strFullPath.indexOf(strPath);var prePath=strFullPath.substring(0,pos);var postPath=strPath.substring(0,strPath.substr(1).indexOf('/ 阅读全文
posted @ 2012-03-29 11:04 猪猪←o 阅读(223) 评论(0) 推荐(0)
摘要:HTML元素添加自定义属性,是通过手动在HTML控件中加上,其实可以在javascript中动态添加:如有一文本框:<input type="text" id="txtInput" name="txtInput" value="自定义文本">如想增加idvalue属性(值为”自定义值”),可以在javascript中这样写:var txt = document.getElementById("txtInput");txt.setAttribute("idvalue" 阅读全文
posted @ 2012-03-28 13:11 猪猪←o 阅读(568) 评论(0) 推荐(0)