码迷,mamicode.com
首页 > Windows程序 > 详细

获得windows对象如url,端口号等,定时显示出来

时间:2017-10-15 21:24:21      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:har   部分   var   fun   on()   angular   nbsp   width   col   

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <script type="text/javascript" src="angular.js" ></script>
        <script>
            var app = angular.module("myapp",[]);
            app.controller("myctrl",function($scope,$timeout){
                //获取宽度
                var wd = window.screen.width;
                $timeout(function(){
                    $scope.widths = wd;
                },2000);
                
                //获取高度
                var hg = window.screen.height;
                $timeout(function(){
                    $scope.heights = hg;
                },2000);
                
                //获取title
                var tt = document.getElementById("biaoti").innerHTML;
                $timeout(function(){
                    $scope.titles = tt;
                },3000);
                
                //获取url协议
                var ur = window.location.protocol;
                $timeout(function(){
                    $scope.urls = ur;
                },3000);
                
                //获取url主机
                var hs = window.location.host;
                $timeout(function(){
                    $scope.urlss = hs;
                },3000);
                
                //获取端口号
                var po = window.location.port;
                 $timeout(function(){
                    //$scope.dkhs = po;
                    var cf = confirm("是否显示端口号");
                    if(cf==true){
                        $scope.dkhs = po;
                    }
                },5000);
                
                //获取URL的hash部分
                var ha = window.location.pathname.hash;
                $timeout(function(){
                    //$scope.dkhs = po;
                    var cf = confirm("是否显示URL的hash部分");
                    if(cf==true){
                        $scope.hashs = ha;
                    }
                },5000);
                
                //获取访问地址
                var pn = window.location.pathname;
                $timeout(function(){
                    //$scope.dkhs = po;
                    var cf = confirm("是否显示访问地址");
                    if(cf==true){
                        $scope.dzs = pn;
                    }
                },5000);

            });
            
        </script>
        <title id="biaoti">123</title>
    </head>
    <body ng-app="myapp" ng-controller="myctrl">
        <p>频幕宽度是:{{widths}}</p>
        <p>频幕高度度是:{{heights}}</p>
        <p>页面title是:{{titles}}</p>
        <p>URL协议是:{{urls}}</p>
        <p>URL主机是:{{urlss}}</p>
        <p>端口号是:{{dkhs}}</p>
        <p>URL的hash部分是:{{hashs}}</p>
        <p>访问地址是:{{dzs}}</p>
    </body>
</html>

获得windows对象如url,端口号等,定时显示出来

标签:har   部分   var   fun   on()   angular   nbsp   width   col   

原文地址:http://www.cnblogs.com/qq402792989/p/7673890.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!