| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1117 人关注过本帖
标题:结果出在哪儿求指点
取消只看楼主 加入收藏
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
结帖率:96.55%
收藏
已结贴  问题点数:25 回复次数:11 
结果出在哪儿求指点
请谅解  程序肯定不是原创的!
程序代码:
<html>
    <head>
        <title>
            Using Properties
        </title>
        <script language="javascript">
            outputWindow = open("", "output")
            function setupWindow()
            {
                outputWindow.document.write("<html><head><title>Output Window</title></head><body>)
            }
       
            function describeNavigator()
            {
                outputWindow.document.write("<h2>Brower Properties</h2>")
                outputWindow.document.write(navigator.appCodeName+ " ")
                outputWindow.document.write(navigator.appName + " ")
                outputWindow.document.write(navigator.appVersion + "<br>")
                outputWindow.document.write(navigator.mimeTypes.length + " MIME types aer defined. ")
                outputWindow.document.write(navigator.plugins.length + " plug-ins are in-stalled.")
            }
            function describeWindow()
            {
                outputWindow.document.write("<h2>Window Properties</h2>")
                outputWindow.document.write("Frames: " + frames.length + "<br>")
                outputWindow.document.write("URL: " + location.href + "<br>")
            }
            function describeDocument()
            {
                outputWindow.document.write("<h2>Document Properties</h2>")
                describeLinks()
                describeForms()
            }
            function describeLinks()
            {
                outputWindow.document.write("<h3>Links</h3>")
                outputWindow.document.write("This document contains" + document.links.length + " links:<br>")
                for (i = 0; i < document.links.length; ++i)
                {
                    outputWindow.document.write(document.links[i].href + "<br>")
                }
            }
            function describeForms()
            {
                outputWindow.document.write("Form " + n + " has " + document.forms[n].elements.length + " elements:")
                for (j = 0; j < document.forms[n].elements.length; ++j)
                {
                    outputWindow.document.write(" " + document.forms[n].elements[j].name)
                }
                outputWindow.document.write("<br>")
            }
            function finishWindow()
            {
                outputWindow.document.write("<form><input type='button' value='Close Window' onclick='window.close()'></form>")
                outputWindow.document.write("</body></html>")
            }
        </script>
    </head>
    <body>
        <h1>Using Hierarchical Object Identifiers</h1>
        <p>
            <a href="http://www.baidu.com">Link to baidu.com.</a>
        </p>
        <p>
            <a href="https://bbs.bccn.net">Link to bccn.net</a>
        </p>
        <form>
            <p>
                <input type="text" name="textField1" value="Enter text here!">
            </p>
            <p>
                <input type="checkbox" name="checkbox1" checked="checked">I'm checkbox1.
            </p>
            <p>
                <input type="checkbox" name="checkbox2">I'm checkbox2
            </p>
            <input type="submit" name="submitButton" value="Click here!">
        </form>
        <script language="javascript">
            setupWindow()
            describeBrowser()
            describeWindow()
            describeDocument()
            finsihWindow()
        </script>
    </body>
</html>



搜索更多相关主题的帖子: title function javascript html 
2012-10-29 23:43
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
回复 2楼 cnfarer
output窗口  是另外再开启的一个页面吧                     

如果是这样子的话     我运行了这个htm    然后没有后面的效果。
2012-10-31 08:36
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
结帖吧,  买了本书回来学习《JavaScript权威指南》
2012-11-01 19:11
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
请教各位  JavaScript   中的  API  怎么理解?
2012-11-06 08:51
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
继续刊登问题
var a = [1, 2, 3];
delete a[2];//删除最后一个元素
2 in a;//=>false: 元素2在数组中已经不存在了
上面一段有点问题,   2 in  a;  这句中的2   按照意思应该是指下标值   但我感觉应该是指其中的数据值2的元素

2012-11-07 09:05
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
回复 7楼 commonname
链接  广告?
2012-11-07 14:33
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
回复 6楼 诸葛修勤
所有的索引都是属性名,但只有在0 ~ 2^32 - 2之间的整数属性名才是索引。


但是这里又有一个问题,  那属性的值到底是多少呢?
难道像这样的数组 var a = [1, 2, 3];  1是‘0’属性的值, 2是属性‘1’的值, 3是属性‘2’的值

2012-11-07 20:12
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
继续刊登问题
程序代码:
///////////////code 1////////////////////
var a1 = [,,,];
var a2 = new Array(3);
0 in a1;//=>true:a1在索引0处有一个元素
0 in a2;//=>false:a2在索引0处没有元素
///////////////code 2////////////////////
var a1 = [,];
var a2 = [undefined];
0 in a1;//=>false:a1在索引0处没有元素
0 in a2;//=>true:a2在索引0处有一个值为undefined的元素

两处的0 in a1; 语句的结果怎么不同     分析应该都是true才对
2012-11-07 20:18
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
写了一个数组排序的     但是排序好像没有进行似的       求指点
程序代码:
<html>
    <head>
        <title>
            _TEST_
        </title>
   
        <script language="javascript">
            [color=#008000]/*
             *自动获取10个数据 并显示到tx_write中
             */
             function OnGetData()
             {
                var count = 0;//计数器
                var tmp_array = [];//数组
           
                while (count < 10)
                {
                    tmp_array[count] = (Math.random()*100)%25;
                    ++count;
                }
           
                //把获取的结果显示出来
                document.text.tx_write.value = tmp_array.join();
             }
           
             /*
              *合并
              */
             function OnMergeResult()
             {
                var tmp_array1 = document.text.tx_write.value.split();
                var tmp_array2 = document.text.tx_bccn.value.split();
                var tmp_array = [];
           
                tmp_array1.sort();
                tmp_array2.sort();
           
                var i = tmp_array1.length;
                var j = tmp_array2.length;
                var k = 0;
           
                while (i !== 0 && j !== 0)
                {
                    if (tmp_array1[i-1] - tmp_array2[j-1]  < 0)
                    {
                        tmp_array[k] = tmp_array2[j-1];
                        --j;
                    }
                    else
                    {
                        tmp_array[k] = tmp_array1[i-1];
                        --i;
                    }
                    ++k;
                }
           
                while (0 !== i)
                {
                    tmp_array[k++] = tmp_array1[i-1];
                    --i;
                }
                while (0 !== j)
                {
                    tmp_array[k++] = tmp_array2[j-1];
                    --j;
                }
           
                document.text.result.value = tmp_array.join();
             }
        </script>
    </head>

    <body>
        <h1 align="center">
            _TEST_
        </h1>
        <form name="text">
            <p>
                请输入一串数组(用','隔开):<input type="text" name="tx_bccn" size="30">
            </p>
            <p>
                自动获取一串数字:<input type="text" name="tx_write" size = "30">
                <input type="button" name="get_data" value="  获取  " onclick="OnGetData()">
            </p>
            <p>
                <input type="button" name="bt_bccn" value="合并" onclick="OnMergeResult()">
            </p>
            <p>
                合并的结果为:<input type="text" name="result" size="45">
            </p>
        </form>
    </body>
</html>



[/color]
2012-11-10 16:28
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
程序代码:
<html>
    <head>
        <style>
            .reveal * { display:none; }
            .reveal *.handle { display:block; }
        </style>
        <script>
            window.onload = function(){
                var elements = document.getElementsByClassName("reveal");
          
                for (var i = 0; i < elements.length; ++i){
                    var elt = elements[i];
                    var title = elt.getElementsByClassName("handle")[0];
                    addRevealHandler(title, elt);
                };
              
                function addRevealHandler(title, elt){
                    title.onclick = function(){
                        if (elt.className == "reveal"){
                            elt.className = "revealed";
                        }else if (elt.className == "revealed"){
                            elt.className = "reveal";
                        }
                    }
                }
            };
        </script>
    </head>
    <body>
        <div class="reveal">
            <h1 class="handle">Click Here to Reveal Hidden Text</h1>
            <p>This paragraph si hidden. It appers when you click on the title.</p>
        </div>
    </body>
</html>

为什么 elt.className = "revealed"; 修改后就可以显示  

.reveal * { display:none; }  修改之后它为什么不起作用?
2012-11-15 19:27
快速回复:结果出在哪儿求指点
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020913 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved