from表單的提交

2021-08-09 21:59:34 字數 3081 閱讀 2793

from表單的提交

1 get 和 post

get 方式提交中文亂碼。

post方式 中文正常。

2 form表單的提交方式

<

formid=

"reg"

>

使用者名稱:

<

input

name

="uname"

type

="text"id=

"uname"

/><

br/>

密碼:<

input

name

="upwd"

type

="text"id=

"upwd"

/><

br/> 年齡

:<

input

name

="age"

type

="text"id=

"age"

/><

br/>

愛好:<

input

name

="hobby"

type

="checkbox"

value

="chi"

class

="x"

/>

chi<

br/>

<

input

name

="hobby"

type

="checkbox"

value

="shui"

class

="x"

/>

shui

<

br/>

<

input

name

="hobby"

type

="checkbox"

value

="dadoudou"

class

="x"

/>

dadoudou

<

br/>

<

input

type

="button"

value="

提交"onclick

="sendajax()"

/>

form

>

方法 1   jquery的傳遞 ,普通傳遞

functionsendajax());

} 方法 2   ajax的傳遞 ,普通傳遞

functionsendajax()

});ar=ar.substring(0,ar.length-1)+

"]"; //

將傳送到伺服器的資料

拼接為json

vartxt ="";

//var  txt ="";

alert(txt);

$.ajax(

}); }

重點  button的提交form表單 ,還可以加校驗

<

formid=

"ff"

>

使用者名稱:

<

input

name

="username"

type

="text"

/><

br/>

密碼:<

input

name

="password"

type

="text"

/><

br/> 年齡

:<

input

name

="age"

type

="text"id=

"age"

/><

br/>

愛好:<

input

name

="hobby"

type

="checkbox"

value

="chi"

class

="x"

/>

chi<

br/>

<

input

name

="hobby"

type

="checkbox"

value

="shui"

class

="x"

/>

shui

<

br/>

<

input

name

="hobby"

type

="checkbox"

value

="dadoudou"

class

="x"

/>

dadoudou

<

br/>

form

>

<

input

type

="button"

name

="button"

value="

提交"onclick

="mysubmit();"/>  // 注意提交在form外面

functionmysubmit()

else}

注意<

input

type

="button"

name

="button"

value="

提交"onclick

="mysubmit();"

/>

在form表單外邊,

否則提示

ff.submit( ) 不是方法

From表單提交重新整理頁面?

form表單提交跳轉 寫作原因 樓主的html水平一般,偶然想起周圍人常說的form表單提交會重新整理頁面,閒來無事,就想想其中的原因 想來想去為什麼會重新整理,猜想了以下幾條 1.先提交資料,等伺服器收到資料後瀏覽器執行類似於f5的操作 2.同時執行資料傳輸,和f5 3.與伺服器的設計有關 4.與...

from表單取消提交隱藏的標籤屬性值

form表單提交被visibility hidden和display none修飾的元素都會隨表單提交 只有disabled true標記的元素不隨表單提交 結論 td 通過 label radio name 通過 checked 未通過 label radio name 未通過 td tr but...

from表單應用

今天,我們來學習from表單的應用,首先,我們要知道from的兩個屬性action和method,前者表示規定表單提交時向何處發生表單資料,後者規定了表單提交的方式,簡單的說就是前者是位址,後者是方式,而提交的方式有兩種,分別是get和post,而這兩者的區別就是,使用get提交時,引數直接暴露在u...