JQuery Select
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Jquery Select</title> </head> <body> <form action="#" method="get"> <select name="city" id="city"> </select> <input type="button" id="sendsms" value="send sms" /> <input type="reset" value="reset" /> <button id="submit">submit</button> </form> <script type="text/javascript" src="${pageContext.request.contextPath}/resource/assets/js/jquery.js"></script> <script type="text/javascript"> $(function(){ $('#city').empty(); $.getJSON("/y/admin/trackcheck.do", { page: '1', id: Math.random() }, function(data) { $.each(data, function(i, v) { //$('<option></option>').val(v['cityid']).text(v['name']).appendTo($('#city')); $('<option></option>').val(v['trackID']).text(v['trackName']).appendTo($('#city')); }); }); $('#city').change(function(){ var val = $(this).val(); alert(val); }); dologin(); sendsms(); }); // ajax登陆 function dologin() { $('#submit').click(function(){ alert('submit clicked'); }); } // click the 'send sms' function sendsms(){ $('#sendsms').click(function(){ disableSendSms(); }); } // 10秒后重发短信 var t = 10; function disableSendSms(){ $('#sendsms').attr('disabled', 'disabled'); if(t > 0){ t--; var timer = setTimeout('disableSendSms()', 1000); $('#sendsms').val(t + ' senond can send sms again'); } else { $('#sendsms').removeAttr('disabled'); $('#sendsms').val('send sms'); t = 10; } } </script> </body> </html>
相关推荐
专注前端开发 2020-10-21
苏康申 2020-11-13
vitasfly 2020-11-12
oraclemch 2020-11-06
liuyang000 2020-09-25
FellowYourHeart 2020-10-05
赵继业 2020-08-17
whyname 2020-08-16
Seandba 2020-08-16
dbasunny 2020-08-16
拼命工作好好玩 2020-08-15
langyue 2020-08-15
写程序的赵童鞋 2020-08-03
Accpcjg 2020-08-02
tydldd 2020-07-30
好记忆也需烂 2020-07-28
jianghero 2020-07-28