js基礎應用小結

2021-09-27 12:09:54 字數 3704 閱讀 1668

三、給某物件賦值

四、ajax調取介面

$

("#d_operate_instruction_get").

parent()

.css

("display"

,'none'

);

var id =

$(obj)

.attr

('id');

var email =

$(obj)

.attr

('email'

);

="form-control" style=

"height: 24px;margin-left: -725%;border-radius: 6px;padding:0;position: absolute;margin-top: -23px;"

id="mode" name=

"mode" onchange=

"switchingmode(this)"

>

'pull' selected>拉伸<

/option>

'peel'

>剝離<

/option>

'tear'

>撕裂<

/option>

'heat-seal'

>熱封<

/option>

'puncture'

>穿刺<

/option>

<

/select>

function

switchingmode

(obj)

}<

/script>

$

('#get_id').

val(id);$

('#get_email').

attr

('value'

, email)

;

1,type="datetime-local"時,時間格式要為 2019-09-28t10:28:

$

('#da_occurrence_time').

attr

('value'

, da_occurrence_time.

replace

(' '

,'t'))

;

2,type="date"時,格式要為 2019-09-28,type="time"時,格式要為10:28:

$

('#d_next_measurement_date').

attr

('value'

, d_next_measurement_date)

;

3,type為file時:

img標籤:

"file" placeholder=

"" name=

"da_instruction_image" accept=

"image/*"

>

$

('#d_operate_flow_chart').

attr

('src'

,'/static/'

+ d_operate_flow_chart)

;

a標籤:

"file" placeholder=

"" name=

"da_instruction_file" accept=

".xls,.doc,.txt,.pdf"

>

$

('#da_instruction_file').

attr

('href'

,'/download/image//'

+ da_instruction_file);$

('#da_instruction_file')[

'0']

.innerhtml = da_instruction_file;

document.

getelementbyid

("da_detail"

).value = da_detail;

var sel = document.

getelementbyid

('get_department_id');

sel.options[0]

.value = department_id;

sel.options[0]

.text = department_name;

1,for迴圈新增select中的option物件
function

addoption

(e)}

;var option_sel =

$(e)

['0'];

if(option_sel.options.length >1)

else

else

option_sel.options[i]

.setattribute

('m_unit'

, materiel_list[i][1

]); option_sel.options[i]

.setattribute

('m_stock'

, materiel_list[i][3

]);}

}}

options =',

data:

,//請求的引數

datatype:

"json"

,//以json格式返回的資料,不是json就把此行去掉

error:

function

(request)

, success:

function

(data)

console.

log(data)

;var situations = data.situations;

for(

var i =

0, length = situations.length; i < length; i++

)else$(

'#tbody1').

(html);$

('#tbody1').

find

('input')[

string

(i *2)

].value = situations[i]

.drcs_describe;$(

'#tbody1').

find

('input')[

string

(i *2+

1)].value = situations[i]

.drcs_method;}}

},};

$.ajaxsetup(}'

}});

$.ajax

(options)

;

function

refreshpage()

JS基礎內容小結(基礎)(一)

字串的各類方法 str.charat 1 從第0個開始計算獲取第乙個子符串,如str 你好嗎 獲取到 好 str.charcodeat 1 獲取對應字串的編碼數字 從第0個開始計算 string.fromcharcode 22937,21619 返回對應字串編碼的字串 以下應該記一下 靜態方法 0 ...

js繼承和基礎繼承小結

前兩天學習js繼承的時候覺得有點繞,子承父 父承子的一通,後來搜到一篇阮一峰大神的繼承方式的部落格學習了一下,現整理了一下主要的五種繼承方式。父構造器person,子構造器man,man是子構造器new出來的物件,只能繼承父構造器中的屬性 代表繼承屬性和方法.第二種叫原型繼承 由於person物件中...

Js基礎學習和應用

1 防止不支援js的瀏覽器出問題可以這樣處理js 2 js放置位置 header 確保指令碼被呼叫時已經載入 body 頁面載入時就呼叫 外部js檔案 不包含標籤 用法 3 注釋 單行 多行 4 全等符號 表示型別和值都相等 5 三種提示框 警告 alert alert 確認 confirm con...