<?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>
共同学习,写下你的评论
评论加载中...
作者其他优质文章