Javascript 常用的一些功能

 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);


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章