完成註冊功能

2022-08-31 01:48:08 字數 965 閱讀 5362

js檔案: onclick函式return true時才提交表單,return false時不提交表單。

function fnlogin() else if(ouname.value.charcodeat(0)>=48&&ouname.value.charcodeat(0)<=57)else for(var i=0;i57)&&(ouname.value.charcodeat(i)<97||ouname.value.charcodeat(i)>122))

}if(oupass.value.length<6||oupass.value.length>20)

if(ocheckpass.value!=oupass.value)

window.alert("註冊成功");

return true;

}

html檔案:

主py檔案中:from flask import  request, redirect, url_for

def regist():

if request.method == 'get':

return render_template('regist.html')

else:

username = request.form.get(『username』)#獲取form中的資料

判斷使用者名稱是否存在:存在報錯

不存在,存到資料庫中

redirect重定向到登入頁

完成註冊功能

js檔案 onclick函式 return true時才提交表單,return false時不提交表單。html檔案 中設定 action和method post 中設定 name 主py檔案中 from flask import request,redirect,url for def regis...

完成註冊功能

js檔案 onclick函式 return true時才提交表單,return false時不提交表單。html檔案 中設定 action和method post 中設定 name 主py檔案中 from flask import request,redirect,url for def regis...

完成註冊功能

1.js檔案 onclick函式 return true時才提交表單,return false時不提交表單。2.html檔案 中設定 action和method post 中設定 name 3.主py檔案中 from flask import request,redirect,url for def...