<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>

<div ng-app="myApp" ng-controller="personCtrl">

<button ng-click="toggle()">点击</button>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('personCtrl', function($scope) {
var submitml=0;  //(设置变量,初始为0)
$scope.toggle = function() {
submitml++;    //(当点击一次按钮,自加一)
if(submitml<3)
{
alert(submitml)
}else
{
window.location.href='http://www.baidu.com';
}
};
});
</script>

</body>
</html>

相关文章:

  • 2021-11-03
  • 2021-10-29
  • 2021-10-29
  • 2021-11-03
  • 2021-10-29
  • 2021-09-19
  • 2021-10-19
  • 2021-11-23
猜你喜欢
  • 2021-10-29
  • 2021-09-19
  • 2021-10-29
  • 2021-11-17
  • 2021-10-29
  • 2021-10-29
  • 2021-10-29
相关资源
相似解决方案