二十章 CI笔记 自动计算

释放双眼,带上耳机,听听看~!

<?php
defined(‘BASEPATH’) OR exit(‘No direct script access allowed’);
class Cs extends CI_Controller {
public function construct()
{
parent::
construct();
$this->load->database();
$this->load->helper(‘form’);
}
public function index(){
$js = ‘onBlur=”jb()”‘;
echo form_input(‘username’, ‘johndoe’, $js);
echo form_input($data=array( ‘name’ => ‘a1’, ‘maxlength’ => ‘2’, ‘size’ => ’50’,’onkeyup’=>”this.value=this.value.replace(/[^0-9]/g, ”)”,’onafterpaste’=>”this.value=this.value.replace(/[^0-9]/g, ”)”) , $value =2);
echo form_input($data=array( ‘name’ => ‘a2’, ‘maxlength’ => ‘3’, ‘size’ => ‘100’,) , $value =3,$js );
echo form_input($data=array( ‘name’ => ‘a3’) , $value =4);
}
}
?>
<script type=”text/javascript”>
function jb(){
document.getElementsByName(“a3”)[0].value=document.getElementsByName(“a2”)[0].value*document.getElementsByName(“a1”)[0].value ;
}
</script>

【转自慕课】https://www.imooc.com

PHP

PHP内核之旅-3.变量

2022-3-3 15:09:07

PHP

PHP学习进阶情况手记,查看情况

2022-3-3 15:18:01

搜索