js獲取div中的文字框資料

2022-03-05 13:22:54 字數 3134 閱讀 1001

通過div得到div裡的所有資料

大神的世界無需解釋,當然不是說我,當我看到這些**的時候我驚呆了!

這是乙個工具方法js:

js: /*

* 獲取指定物件下的所有input、textarea值

* divid:外層的id

* jsonstr:如果無,新建立乙個物件,如果有,直接在物件中新增

* ischeck:是否進行必填項判斷

*/getformparam: function(divid,jsonstr,ischeck);

if(jsonstr)

var iserror =false

; $.each(inputlist,function(i,obj)

else

else);}}}

else

if(ligeruiid)

if(name)

else

}});

$.each(textarealist,function(i,obj)

else

else);}}}

else

if(name)

else

}});

if(iserror)

return

param;

}

html:

class="

l-panel-search-cond clearfix

" id='

main_t

'>

class="

float-l

">

class="

l-panel-search-title

">

借款用途:

class="

l-panel-search-item

">

"text

" id="

credit_purpose

" style="

width:430px

" isrequired="

1"/>

class="

float-l

">

class="

l-panel-search-title

">       信貸產品種類:

class="

l-panel-search-item

">

"text

" id="

cre_loan_type

" ligeruiselectisrequired="

1"/>

class="

float-l clearboth

">

class="

float-l

">

class="

l-panel-search-title

">申請貸款額度:

class="

l-panel-search-item

">

"text

" id="

credit_limit

" style="

width:95px

" isrequired="

1" isfloat="

1" minval="

0" maxval="

100000000

"/>(萬元)

class="

float-l

">

class="

l-panel-search-title

">可接受每月最高還款額:

class="

l-panel-search-item

">

"text

" id="

max_repayment_limit_per_month

" style="

width:95px

" isrequired="

1" isfloat="

1" minval="

0" maxval="

1000000

"/> (元/月)

class="

float-l

">

class="

l-panel-search-title

"> 申請最長還款期限:

class="

l-panel-search-item

">

"text

" id="

max_repayment_time_limit

" style="

width:95px

" isrequired="

1" ispositiveinteger="

1" minval="

1" maxval="

120" scope="

a"/>(月)

class="

float-l

">

class="

l-panel-search-title

">      共貸情況:

class="

l-panel-search-item

">

"text

" id="

hasconmpre

" style="

width:95px

" isrequired="

1" />

將div裡的值獲取後傳向後台:

var

jsonstr;

jsonstr = globalutil.getformparam('

main_t

',null,false

); $(

"#tb_btn

").css("

display

","none

");//

隱藏按鈕

$.post(globalutil.gettimestampurl("

/cremanage/mcscrecreditheadupdate.do"),

jsonstr, function(data) );

//儲存成功

}else

});

JS獲取文字框的值

1.通過getelementbyid 方法獲得,必須為文字框設定id值,該方法獲得的是乙個物件的應用 返回值 為 object 要獲得文字框的值需新增屬性值 value,如 獲值 document.getelementbyid port11 value 另 要獲得標籤 document.getele...

js 文字框限制

keyup this.value this.value.replace d g,onafterpaste this.value this.value.replace d g,2.只能輸入數字,能輸小數點.keyup if isnan value execcommand undo onafterpas...

silverlight 獲取文字框焦點

1,如果專案允許在瀏覽器外執行 this.loaded object sender,routedeventargs e this.txtmoney.focus 使用者名稱文字聚焦 2,專案為瀏覽器執行 this.loaded object sender,routedeventargs e htmlp...