文章分类 - 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('/
阅读全文
摘要:HTML元素添加自定义属性,是通过手动在HTML控件中加上,其实可以在javascript中动态添加:如有一文本框:<input type="text" id="txtInput" name="txtInput" value="自定义文本">如想增加idvalue属性(值为”自定义值”),可以在javascript中这样写:var txt = document.getElementById("txtInput");txt.setAttribute("idvalue"
阅读全文

浙公网安备 33010602011771号