- <!DOCTYPE html>
- <html>
- <head>
- <title>javascript选项卡切换速度控制实例Demo</title>
- <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”/>
- <script src=“http://libs.baidu.com/jquery/1.9.0/jquery.js”></script>
- </head>
- <body>
-
- <script style=“text/javascript”>
- var time =0;
- $(“#xgt a”).click(function(){
-
-
- if(time==1){
-
- if(!qiehuan())return false;
- }
-
- time =1;
-
- nowTimestamp =new Date().getTime();
-
- $(“#xgt a”).removeClass(‘active’);
- $(this).addClass(“active”)
- var func = $(this).attr(‘function’);
-
- $.post(“/mpyp/get_cases_xgts”, { func:func,id:id},
- function(data){
- if(data){
- var obj = JSON.parse(data);
- if(obj.imgs !=”){
- $(“#xgt_show”).html(obj.imgs);
- $(“#func_name”).html(obj.func);
- }
- }
- });
-
- });
-
-
- function qiehuan()
- {
-
- var curTimestamp = new Date().getTime();
-
- if(curTimestamp/1000 – nowTimestamp/1000<=3)
- {
- alert(‘切换速度过于快!’)
- return false;
- }
- return true;
- }
- </script>
- </body>
- </html>