按钮

react 初始

≯℡__Kan透↙ 提交于 2020-01-14 22:24:58
import React, { Component } from 'react' import "./footer.css" ; //引入外部样式表 export default class footer extends Component { //这里的extends继承父类的属性和方法,但是没有自己的属性和方法 constructor(props) { super (props); this .state = { num: 10 } // this.num = 1; this .show9 = this .show9.bind( this ); // this.show9 = this.show9.apply(this); //用call和apply会直接调用函数页面刷新时就会调用show9 console.log( this , this .show9); } show4() { alert(1111 + "声明的函数show" ); } show5 = () => { alert( this .state.num + "声明的箭头函数" ); } show7 = (content) => { alert(content + "带参数的箭头函数" ); } show8 = () => { alert( "bind函数" ); } show9() { alert( this

Android学习日志2020-1-14

烂漫一生 提交于 2020-01-14 20:37:13
接收验证码用的倒计时 如果需要在倒计时时对ui组件进行操作,像接收手机验证码时的倒计时,不能新建普通进程,产生错误,例如thread之类。 android.util.AndroidRuntimeException: Animators may only be run on Looper threads //子线程内不可改变ui 一个可以用于计时的类,也可以处理固定时间并且要在固定时间间隔刷新的操作。这个类叫做CountDownTimer,idea中点击类名可以查看详细信息: /** * Schedule a countdown until a time in the future, with * regular notifications on intervals along the way. * * Example of showing a 30 second countdown in a text field: * * <pre class="prettyprint"> * new CountDownTimer(30000, 1000) { * * public void onTick(long millisUntilFinished) { * mTextField.setText("seconds remaining: " + millisUntilFinished /

自定义属性

走远了吗. 提交于 2020-01-14 20:01:52
<script> window.onload = function (){ var aBtn = document.getElementsByTagName('input'); for( var i=0; i<aBtn.length; i++ ){ aBtn[i].index = i; // 自定义属性(索引值) aBtn[i].onclick = function (){ // alert( i ); // 3 alert( this.index ); }; } }; </script> </head> <body> <input type="button" value="btn1" /> <input type="button" value="btn2" /> <input type="button" value="btn3" /> 来源: https://www.cnblogs.com/tongguilin/p/12193569.html

08React中事件的写法总结

浪尽此生 提交于 2020-01-14 19:40:16
1:事件与原生事件类型 react中式on+首字母大写的事件名 例如onClick 如图 只需要on以后常用的事件都会提示出来 2:在Content.js中新建一系列的按钮来对事件进行学习 2.1 普通的函数绑定 <button onClick={function(){alert('6666')}}>按钮1</button> 2.2 箭头函数的绑定 <button onClick={()=>{ alert("7777"); }}>按钮2</button> 2.3 箭头函数带参数 <button onClick={(e)=>{ e.target.style.color="red"; }}>按钮3</button> 2.4 页面部分 <button onClick={ this.show }>按钮4</button> 在render的上面定义一个函数 细节看alert中的提示 constructor(props){ super(props); this.state={ num:10 } //this.show9 = this.show9.bind(this); } show(){ alert("按钮4被点击 但是里面this会脱离上下文关系"); alert(this.state.num);//报错 this是undefined } 2.5 利用箭头函数 对this指向进行加强

索引值应用

微笑、不失礼 提交于 2020-01-14 19:38:44
<script> window.onload = function (){ var aBtn = document.getElementsByTagName('input'); var aP = document.getElementsByTagName('p'); // 想建立“匹配”“对应”关系,就用索引值 var arr = [ '莫涛', '张森', '杜鹏' ]; for( var i=0; i<aBtn.length; i++ ){ aBtn[i].index = i; // 自定义属性(索引值) aBtn[i].onclick = function (){ // alert( arr[ this.index ] ); this.value = arr[ this.index ]; aP[ this.index ].innerHTML = arr[ this.index ]; }; } }; </script> </head> <body> <input type="button" value="btn1" /> <input type="button" value="btn2" /> <input type="button" value="btn3" /> 来源: https://www.cnblogs.com/tongguilin/p/12193602.html

jQuery选择器

耗尽温柔 提交于 2020-01-14 15:59:17
元素选择器 用户点击按钮后,所有 <p> 元素都隐藏: $(document).ready(function(){ $("button").click(function(){ $("p").hide(); }); }); #id 选择器 当用户点击按钮后,有 id="test" 属性的元素将被隐藏: $(document).ready(function(){ $("button").click(function(){ $("#test").hide(); }); }); .class 选择器 用户点击按钮后所有带有 class="test" 属性的元素都隐藏: $(document).ready(function(){ $("button").click(function(){ $(".test").hide(); }); }); 更多例子 1、当前元素 <script> $(document).ready(function(){ $("button").click(function(){ $(this).hide();//表示当前元素button }); }); </script> 2、所有元素 <script> $(document).ready(function(){ $("button").click(function(){ $("*").hide();/

抓网页_面包网_javaSE

泪湿孤枕 提交于 2020-01-14 15:33:07
ZC: javase部分的 获取信息的相关代码,看 抓网页_面包网_javaSE 。 1、index.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%> <%@page import="mianBao.*, z_utils.*"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta charset="UTF-8"> <!-- for HTML5 --> <title>电影信息JSP</title> <style type="text/css"> .movieDetailMsg { } .moviePic { width:112px; } table { background-color: white; padding-left: 5px; } table tr:nth-child(2) { background-color:

vue二维码生成与下载

佐手、 提交于 2020-01-14 15:09:09
踩坑总结-vue 二维码下载 二维码下载 先安装qriously npm install vue-qriously 直接上代码啦啦啦 <div class="box"> <qriously id='mycanvas' :value="this.value" :size="this.size" /> <el-button size="mini" type="primary" @click="handleDownloadQr2"> 下载 </el-button> </div> data(){ value:'www.baidu.com', size:200, } handleDownloadQr2(){ let canvas = document.querySelector('#mycanvas canvas'); let imgSrc = canvas.toDataURL(); let elem = document.createElement('a'); elem.setAttribute('href', imgSrc); elem.setAttribute('download', '二维码.png'); document.body.appendChild(elem); elem.click(); document.body.removeChild(elem); }, 重点: let

button和sumbit提交表单的区别

﹥>﹥吖頭↗ 提交于 2020-01-14 12:15:24
最新弄了个asp的软件,提交表单有点生疏了,下面总结了一下通过button和sumbit两种方式来提交表单: sumbit提交表单 View Code < meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" /> < title > 无标题文档 </ title > < script type ="text/javascript" > function checkForm() { if (document.form1.userName.value.length == 0 ) { alert( " 请输入用户名! " ); return false ; } return true ; document.form1.submit(); } </ script > </ head > < body > < form name ="form1" method ="post" action ="ygdacx.html" onsubmit ="return checkForm()" > < input type ="text" name ="userName" size ="10" /> < input type ="submit" value ="提 交" /> </ form > </ body > </

form表单重复提交,type=“button”和type=“submit”区别

淺唱寂寞╮ 提交于 2020-01-14 12:11:36
公司测试提了一个项目后台在IE浏览器下(360,firefox就没问题)出现数据重复的问题,调试了好久终于发现问题所在,也不知道是谁写的代码,醉醉的。。。。 错误地点: <input type="submit" value="提交" class="btn" id="formSubmit" onclick="checkForm()" /> type类型写成submit,而在checkForm中也进行了form提交。 type=“button”和type="submit"在IE firefox 360下分别进行submit()提交和走ajax测试: 测试代码: <body> <form id="form1" method="get" > <input name="username" value="zhangsan" /><br> <input name="age" value="20" /><br> <input name="address" value="beijing" /><br> <input name="birthday" value="10-12" /><br> <input name="contactInfo.tel" value="13321464327" /><br> <input name="contactInfo.address" value="hebei" />