您的位置:首页 > Web前端 > JavaScript

Javascript 常用的一些功能

2015-01-05 16:41 281 查看
String.prototype.trim = function () {
return this.replace(/(^\s*)|(\s*$)/g, "");
}


使用方法 string.trim();

关于 Select 标签,获取选中的值/文本

var test = document.GetElementById("test");
var test_value = test.options[test.options.selectedIndex].value;
var test_txt = test.options[test.options.selectedIndex].text;
alert(test_value);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: