php window.onload,tp_window.onload+相应操作
[php]代碼庫
window.οnlοad=function(){
if(==0){
document.getElementsByName('sex')[1].checked='checked';
}else{
document.getElementsByName('sex')[0].checked='checked';
}
}
class UserAction extends Action{
public function index(){
$m=M('User');
$arr=$m->select();
//var_dump($arr);
$this->assign('data',$arr);
$this->display();
}
public function del(){
$m=M('User');
$id=$_GET['id'];
$count=$m->delete($id);
if($count>0){
$this->success('數據刪除成功');
}else{
$this->error('數據刪除失敗');
}
}
/*
* 顯示修改頁面
* */
public function modify(){
$id=$_GET['id'];
$m=M('User');
$arr=$m->find($id);
$this->assign('data',$arr);
$this->display();
}
public function update(){
$m=M('User');
$data['id']=$_POST['id'];
$data['username']=$_POST['username'];
$data['sex']=$_POST['sex'];
$count=$m->save($data);
if($count>0){
$this->success('數據修改成功','index');
}else{
$this->error('數據修改失敗');
}
}
/*
* 添加頁面
* */
public function add(){
$this->display();
}
public function create(){
$m=M('User');
$m->username=$_POST['username'];
$m->sex=$_POST['sex'];
$idNum=$m->add();
if($idNum>0){
$this->success('數據添加成功','index');
}else{
$this->error('數據添加失敗');
}
}
}
?>
-------------------------------------------------------------------
添加用戶
function jump(){
window.location="/thinkphp/index.php/User/add";
}
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的php window.onload,tp_window.onload+相应操作的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring整合JDBC开发
- 下一篇: Windows10 64位 安装 Pos