CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Java >  Web 开发

一个javascript代码

楼主flyfoxs(寻找财富自由之路)2005-06-03 22:41:26 在 Java / Web 开发 提问

我有下面三个关于javascript的问题,希望会的人帮我解答一下,再此先谢谢了!  
   
  1)下面这个网页的javascript打开的入口在哪个地方,也就是说它第一个执行的是哪个函数。  
   
  2)网页中的<script>没有指明是使用VBscript,还是javascript,是怎么回事。  
   
  3)并且网页中有两个<script></script>块,并且是挨着的,为什么要用两个<script></script>,不可以把两个合并成一个吗?  
   
   
  <!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.0   Transitional//EN">  
  <HTML>  
  <HEAD>  
  <TITLE>   DSTree   </TITLE>  
  <META   NAME="Author"   CONTENT="sTarsjz@hotmail.com"   >  
  <style>  
  body,td{font:12px   verdana}  
  #treeBox{background-color:#fffffa;}  
  #treeBox   .ec{margin:0   5   0   5;}  
  #treeBox   .hasItems{font-weight:bold;height:20px;padding:3   6   0   6;margin:2px;cursor:hand;color:#555555;border:1px   solid   #fffffa;}  
  #treeBox   .Items{height:20px;padding:3   6   0   6;margin:1px;cursor:hand;color:#555555;border:1px   solid   #fffffa;}  
  </style>  
  <base   href="http://vip.5d.cn/star/dstree/"   />  
  <script>  
  //code   by   star   20003-4-7  
  var   HC   =   "color:#990000;border:1px   solid   #cccccc";  
  var   SC   =   "background-color:#efefef;border:1px   solid   #cccccc;color:#000000;";  
  var   IO   =   null;  
  function   initTree(){  
  var   rootn   =   document.all.menuXML.documentElement;  
  var   sd   =   0;  
  document.onselectstart   =   function(){return   false;}  
  document.all.treeBox.appendChild(createTree(rootn,sd));  
  }  
  function   createTree(thisn,sd){  
  var   nodeObj   =   document.createElement("span");  
  var   upobj   =   document.createElement("span");  
  with(upobj){  
  style.marginLeft   =   sd*10;  
  className   =   thisn.hasChildNodes()?"hasItems":"Items";  
  innerHTML   =   "<img   src=home2.gif   class=ec>"   +   thisn.getAttribute("text")   +"";  
   
  onmousedown   =   function(){  
  if(event.button   !=   1)   return;  
  if(this.getAttribute("cn")){  
  this.setAttribute("open",!this.getAttribute("open"));  
  this.cn.style.display   =   this.getAttribute("open")?"inline":"none";  
  this.all.tags("img")[0].src   =   this.getAttribute("open")?"home2.gif":"contract.gif";  
  }  
  if(IO){  
  IO.runtimeStyle.cssText   =   "";  
  IO.setAttribute("selected",false);  
  }  
  IO   =   this;  
  this.setAttribute("selected",true);  
  this.runtimeStyle.cssText   =   SC;  
  }  
  onmouseover   =   function(){  
  if(this.getAttribute("selected"))return;  
  this.runtimeStyle.cssText   =   HC;  
  }  
  onmouseout   =   function(){  
  if(this.getAttribute("selected"))return;  
  this.runtimeStyle.cssText   =   "";  
  }  
  oncontextmenu   =   contextMenuHandle;  
  onclick   =   clickHandle;  
  }  
   
  if(thisn.getAttribute("treeId")   !=   null){  
  upobj.setAttribute("treeId",thisn.getAttribute("treeId"));  
  }  
  if(thisn.getAttribute("href")   !=   null){  
  upobj.setAttribute("href",thisn.getAttribute("href"));  
  }  
  if(thisn.getAttribute("target")   !=   null){  
  upobj.setAttribute("target",thisn.getAttribute("target"));  
  }  
   
  nodeObj.appendChild(upobj);  
  nodeObj.insertAdjacentHTML("beforeEnd","<br>")  
   
  if(thisn.hasChildNodes()){  
  var   i;  
  var   nodes   =   thisn.childNodes;  
  var   cn   =   document.createElement("span");  
  upobj.setAttribute("cn",cn);  
  if(thisn.getAttribute("open")   !=   null){  
  upobj.setAttribute("open",(thisn.getAttribute("open")=="true"));  
  upobj.getAttribute("cn").style.display   =   upobj.getAttribute("open")?"inline":"none";  
  if(   !upobj.getAttribute("open"))upobj.all.tags("img")[0].src   ="contract.gif";  
  }  
   
  for(i=0;i<nodes.length;cn.appendChild(createTree(nodes[i++],sd+1)));  
  nodeObj.appendChild(cn);  
  }  
  else{  
  upobj.all.tags("img")[0].src   ="endnode.gif";  
  }  
  return   nodeObj;  
  }  
  window.onload   =   initTree;  
  </script>  
   
  <script>  
  function   clickHandle(){  
  //   your   code   here    
  }  
  function   contextMenuHandle(){  
  event.returnValue   =   false;  
  var   treeId   =   this.getAttribute("treeId");  
  //   your   code   here  
  }  
  </script>  
  </HEAD>  
  <BODY>  
  <xml   id=menuXML>  
  <?xml   version="1.0"   encoding="GB2312"?>  
  <DSTreeRoot   text="&cedil;ù&frac12;&Uacute;&micro;&atilde;"   open="true"   href="http://"   treeId="123">  
   
  <DSTree   text="&frac14;&frac14;&Ecirc;&otilde;&Acirc;&Ucirc;&Igrave;&sup3;"   open="false"   treeId="">  
  <DSTree   text="5DMedia"   open="false"   href="http://"   target="box"   treeId="12">  
  <DSTree   text="&Iacute;&oslash;&Ograve;&sup3;±à&Acirc;&euml;"   href="http://"   target="box"   treeId="4353"   />  
  <DSTree   text="&Ecirc;&Ouml;&raquo;&aelig;"   href="http://"   target="box"   treeId="543543"   />  
  <DSTree   text="&sup1;à&Euml;&reg;"   href="http://"   target="box"   treeId="543543"   />  
  </DSTree>  
  <DSTree   text="BlueIdea"   open="false"   href="http://"   target="box"   treeId="213">  
  <DSTree   text="DreamWeaver   &amp;   JS"   href="http://"   target="box"   treeId="4353"   />  
  <DSTree   text="FlashActionScript"   href="http://"   target="box"   treeId="543543"   />  
  </DSTree>  
  <DSTree   text="CSDN"   open="false"   href="http://"   target="box"   treeId="432">  
  <DSTree   text="JS"   href="http://"   target="box"   treeId="4353"   />  
  <DSTree   text="XML"   href="http://"   target="box"   treeId="543543"   />  
  </DSTree>  
  </DSTree>  
   
  <DSTree   text="×&Ecirc;&Ocirc;&acute;&Otilde;&frac34;&micro;&atilde;"   open="false"   treeId="">  
  <DSTree   text="&Euml;&Oslash;&sup2;&Auml;&Icirc;&Yacute;"   href="http://"   target="box"   treeId="12"   />  
  <DSTree   text="×&Agrave;&Atilde;&aelig;&sup3;&Ccedil;&Ecirc;&ETH;"   open="false"   href="http://"   target="box"   treeId="213">  
  <DSTree   text="±&Uacute;&Ouml;&frac12;"   href="http://"   target="box"   treeId="4353"   />  
  <DSTree   text="×&Ouml;&Igrave;&aring;"   href="http://"   target="box"   treeId="543543"   />  
  </DSTree>  
  <DSTree   text="MSDN"   open="false"   href="http://"   target="box"   treeId="432">  
  <DSTree   text="DHTML"   href="http://"   target="box"   treeId="4353"   />  
  <DSTree   text="HTC"   href="http://"   target="box"   treeId="543543"   />  
  <DSTree   text="XML"   href=""   target="box"   treeId="2312"   />  
  </DSTree>  
  </DSTree>  
   
  </DSTreeRoot>  
  </xml>  
  <table   style="position:absolute;left:100;top:100;">  
  <tr><td   id=treeBox   style="width:400px;height:200px;border:1px   solid   #cccccc;padding:5   3   3   5;"   valign=top></td></tr>  
  <tr><td           style="font:10px   verdana;color:#999999"   align=right>by   <font   color=#660000>sTar</font><br>   2003-4-8</td></tr>  
  </table>  
  </BODY>  
  </HTML>  
  问题点数:20、回复次数:7Top

1 楼flyfoxs(寻找财富自由之路)回复于 2005-06-04 08:03:55 得分 0

自己项一下,我由于急要,请知情人士,帮帮忙。Top

2 楼flyfoxs(寻找财富自由之路)回复于 2005-06-04 09:23:19 得分 0

急啊,在线等,一搞定,马上就结帖!Top

3 楼jihanzhong(逍遥)回复于 2005-06-04 09:47:59 得分 10

1)下面这个网页的javascript打开的入口在哪个地方,也就是说它第一个执行的是哪个函数。  
      js顺序执行,没什么入口,然后function事件看按钮激活的是哪个  
   
  2)网页中的<script>没有指明是使用VBscript,还是javascript,是怎么回事。  
    没关系,他会认的  
   
  3)并且网页中有两个<script></script>块,并且是挨着的,为什么要用两个<script></script>,不可以把两个合并成一个吗?  
  可以合并,没什么差别Top

4 楼flyfoxs(寻找财富自由之路)回复于 2005-06-04 10:20:42 得分 0

2)网页中的<script>没有指明是使用VBscript,还是javascript,是怎么回事。  
    没关系,他会认的???  
  这么说来,统统都可以不写了。只是想知道可不可以。  
  Top

5 楼tangfulin(雨寒月)回复于 2005-06-04 12:39:20 得分 5

好像不行的说Top

6 楼flyfoxs(寻找财富自由之路)回复于 2005-06-04 14:40:01 得分 0

在这里有一些相关答案  
   
  http://community.csdn.net/Expert/topic/4058/4058502.xml?temp=.235943Top

7 楼javalin3012(创薪型人才)回复于 2005-06-04 15:42:35 得分 5

运行时间错误:  
   
  className   =   thisn.hasChildNodes()?"hasItems":"Items";  
  thisn是传入的参数、可能是个页面控件、看看是不是有ID和它重的、Top

相关问题

  • 求javascript代码!
  • 求JavaScript代码一段
  • 求一个JAVASCRIPT源代码
  • 求一段javascript代码
  • asp.net中的javascript代码
  • javascript的代码问题
  • 求一段 JavaScript 代码
  • 求一段 Javascript 代码……
  • 求一段 Javascript 代码……
  • 求javascript代码中显示和隐藏文本框的代码。

关键词

得分解答快速导航

  • 帖主:flyfoxs
  • jihanzhong
  • tangfulin
  • javalin3012

相关链接

  • CSDN Java频道
  • Java类图书
  • Java类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo