php 操作提示框

/**
     * 跳转
     * @param type $msg
     * @param type $url
     */
    protected function jump($msg, $url)
    {
        $html = <<<EOF
<!DOCTYPE html>
<html lang="en">
	<head><title>提示</title></head>
	<style>
body {
  font-size: 100%;
  font-family: "Lato", sans-serif;
  color: #8f9cb5;
  background-color: #ffd88f;
}
.cd-popup {
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(94, 110, 141, 0.9);
  opacity: 0;
  visibility: hidden;
  -webkit-transition: opacity 0.3s 0s, visibility 0s 0.3s;
  -moz-transition: opacity 0.3s 0s, visibility 0s 0.3s;
  transition: opacity 0.3s 0s, visibility 0s 0.3s;
}
.cd-popup.is-visible {
  opacity: 1;
  visibility: visible;
  -webkit-transition: opacity 0.3s 0s, visibility 0s 0s;
  -moz-transition: opacity 0.3s 0s, visibility 0s 0s;
  transition: opacity 0.3s 0s, visibility 0s 0s;
}

.cd-popup-container {
  position: relative;
  width: 90%;
  max-width: 400px;
  margin: 4em auto;
  background: #FFF;
  border-radius: .25em .25em .4em .4em;
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  -webkit-transform: translateY(-40px);
  -moz-transform: translateY(-40px);
  -ms-transform: translateY(-40px);
  -o-transform: translateY(-40px);
  transform: translateY(-40px);
  /* Force Hardware Acceleration in WebKit */
  -webkit-backface-visibility: hidden;
  -webkit-transition-property: -webkit-transform;
  -moz-transition-property: -moz-transform;
  transition-property: transform;
  -webkit-transition-duration: 0.3s;
  -moz-transition-duration: 0.3s;
  transition-duration: 0.3s;
}
.cd-popup-container p {
  padding: 1em 1em;
}
	</style>
	<body>
		<div class="cd-popup is-visible" role="alert">
			<div class="cd-popup-container">
				<p>{$msg}</p>
				<span id="time" style="background: red;">3</span>
				秒后自动跳转,如不跳转,请点击:<a href="{$url}">{$msg}</a>
			</div> <!-- cd-popup-container -->
		</div> <!-- cd-popup -->
		
		<script  type="text/javascript">
		
				delayURL("{$url}");
				
				function delayURL(url) {
					var delay = document.getElementById("time").innerHTML;
					if (delay > 0) {
						delay--;
						document.getElementById("time").innerHTML = delay
					} else {
						window.top.location.href = url
					}
					setTimeout("delayURL('" + url + "')", 1000)
				}

		</script>
	</body>
</html>
EOF;
        echo $html;die;
    }

  

posted @ 2016-11-03 11:23  xyyphp  阅读(321)  评论(0编辑  收藏  举报