| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 663 人关注过本帖
标题:Javascript 數組的問題!
只看楼主 加入收藏
xunmi_love
Rank: 2
等 级:论坛游民
帖 子:204
专家分:18
注 册:2006-10-14
结帖率:57.14%
收藏
 问题点数:0 回复次数:1 
Javascript 數組的問題!
<script type="text/javascript">
    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
    xmlDoc.async=false
    xmlDoc.load("dbxml.xml")
    function getArr(s,arrValue)
    {
        var arrResult=new Array();
        if(s!="")
        {
            for(var i=0;i<arrValue.length;i++)
            {
                if(arrValue[i].indexOf(s)==0)
                {
                    arrResult.push(arrValue[i]);
                }
            }
        }
        return arrResult;
     }  
   window.onload=function ()
   {
        document.getElementById("ww").style.display="none";
    }
    function g()//取得焦點時執行動作;
    {
         var aa=document.getElementById("Text1").value;
         if(aa=="") return;
        var root=xmlDoc.documentElement
         var le=root.childNodes.length;
         var stra="Please Check here";
         for(var i =0;i<le;i++)
        {
            stra=stra+","+xmlDoc.getElementsByTagName("name")[i].firstChild.data;
        }
        var arr=[stra];
       // document.write(arr);--這裏是兩個數組,爲什麽粗體的數組就不行呢?請各位路過的大蝦指教!
         var arrs=["red","orange","yellow0","yellow1","yellow2","yellow3","violet4","yellow5","yellow6","yellow7","yellow8","yellow9","yellow10","yellow11","yellow12","yellow13","yellow14","black","tan","ivory","navy","aqua","white","purple","pink","gray","silver"];
//      document.write(arrs);
         arr.sort();
         var arrResult=getArr(aa,arrs);
         var ww=document.getElementById("ww");
         ww.options.length=0;
         for(var i=0;i<arrResult.length;i++)
         {
            ww.options.add(new Option(arrResult[i],arrResult[i]));
         }
        document.getElementById("ww").style.display="";
    }   
    function t()//失去焦點時不顯示;
    {
        document.getElementById("ww").style.display="none";
    }
    function x()
   {
        document.getElementById("ww").style.display="";
   }
  function y()//select 取得焦點的時候,不隱藏;
  {
        var sel=document.getElementById("ww");
        var se="";
        for(var i =0;i<sel.options.length; i++)
        {
            if(sel.options[i].selected==true)
            se=sel.options[i].value;
        }
        document.getElementById("Text1").value=se;
        document.getElementById("ww").style.display="none";
  }  
搜索更多相关主题的帖子: Javascript 
2009-09-16 16:35
soky
Rank: 4
等 级:业余侠客
帖 子:126
专家分:228
注 册:2009-7-13
收藏
得分:0 
lz想问什么?
2009-09-19 19:40
快速回复:Javascript 數組的問題!
数据加载中...
 
   



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

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