js应用4

xml 代码
  1. 101.饼图   
  2. <style>  
  3. v\:*     { behavior: url(#default#VML) }   
  4. o\:*     { behavior: url(#default#VML) }   
  5. .shape    { behavior: url(#default#VML) }   
  6. </style>  
  7. <script language="javascript">  
  8. function show(pie)   
  9. {   
  10. piepie.strokecolor=pie.fillcolor;   
  11. pie.strokeweight=10;   
  12. div1.innerHTML="<font size=2 color=red> " + pie.id +"</font> <font size=2>" + pie.title + "</font>";   
  13. }   
  14. function hide(pie)   
  15. {   
  16. pie.strokecolor="white";   
  17. pie.strokeweight=1;   
  18. div1.innerHTML="";   
  19. }   
  20. </script>  
  21. </head>  
  22. <body>  
  23. <v:group style='width: 5cm; height: 5cm' coordorigin='0,0' coordsize='250,250'>  
  24. <v:shape id='asp技术' style='width:10;height:10;top:10;left:0' title='得票数:6 比例:40.00%'    
  25.   
  26. onmouseover='javascript:show(this);' onmouseout='javascript:hide(this);' href='http://www.cnADO.com'    
  27.   
  28. CoordSize='10,10' strokecolor='white' fillcolor='#ffff33'><v:path v='m 300,200 ae    
  29.   
  30. 300,200,200,150,0,9437184 xe'/></v:shape>  
  31. <v:shape id='php' style='width:10;height:10;top:10;left:0' title='得票数:1 比例:6.67%'    
  32.   
  33. onmouseover='javascript:show(this);' onmouseout='javascript:hide(this);' href='http://www.cnADO.com'    
  34.   
  35. CoordSize='10,10' strokecolor='white' fillcolor='#ff9933'><v:path v='m 300,200 ae    
  36.   
  37. 300,200,200,150,9437184,1572864 xe'/></v:shape>  
  38. <v:shape id='jsp' style='width:10;height:10;top:10;left:0' title='得票数:2 比例:13.33%'    
  39.   
  40. onmouseover='javascript:show(this);' onmouseout='javascript:hide(this);' href='http://www.cnADO.com'    
  41.   
  42. CoordSize='10,10' strokecolor='white' fillcolor='#3399ff'><v:path v='m 300,200 ae    
  43.   
  44. 300,200,200,150,11010048,3145728 xe'/></v:shape>  
  45. <v:shape id='c#写的.netWEB程序' style='width:10;height:10;top:10;left:0' title='得票数:3 比例:20.00%'    
  46.   
  47. onmouseover='javascript:show(this);' onmouseout='javascript:hide(this);' href='http://www.cnADO.com'    
  48.   
  49. CoordSize='10,10' strokecolor='white' fillcolor='#99ff33'><v:path v='m 300,200 ae    
  50.   
  51. 300,200,200,150,14155776,4718592 xe'/></v:shape>  
  52. <v:shape id='vb.net写的.netWEB程序' style='width:10;height:10;top:10;left:0' title='得票数:2 比例:13.33%'    
  53.   
  54. onmouseover='javascript:show(this);' onmouseout='javascript:hide(this);' href='http://www.cnADO.com'    
  55.   
  56. CoordSize='10,10' strokecolor='white' fillcolor='#ff6600'><v:path v='m 300,200 ae    
  57.   
  58. 300,200,200,150,18874368,3145728 xe'/></v:shape>  
  59. <v:shape id='xml技术' style='width:10;height:10;top:10;left:0' title='得票数:1 比例:6.67%'    
  60.   
  61. onmouseover='javascript:show(this);' onmouseout='javascript:hide(this);' href='http://www.cnADO.com'    
  62.   
  63. CoordSize='10,10' strokecolor='white' fillcolor='#ff99ff'><v:path v='m 300,200 ae    
  64.   
  65. 300,200,200,150,22020096,1572864 xe'/></v:shape>  
  66. </v:group>  
  67.   
  68. <v:group style='width: 6cm; height: 6cm' coordorigin='0,0' coordsize='250,250'>  
  69. <v:rect style='height:10;width:15;top:0;left:10' fillcolor='#ffff33'/>  
  70. <v:rect style='height:28;width:100;top:0;left:30' stroked='false'><v:textbox    
  71.   
  72. style='fontsize:2'>asp技术</v:textbox/></v:rect>  
  73. <v:rect style='height:10;width:15;top:30;left:10' fillcolor='#ff9933'/>  
  74. <v:rect style='height:28;width:100;top:30;left:30' stroked='false'><v:textbox    
  75.   
  76. style='fontsize:2'>php</v:textbox/></v:rect>  
  77. <v:rect style='height:10;width:15;top:60;left:10' fillcolor='#3399ff'/>  
  78. <v:rect style='height:28;width:100;top:60;left:30' stroked='false'><v:textbox    
  79.   
  80. style='fontsize:2'>jsp</v:textbox/></v:rect>  
  81. <v:rect style='height:10;width:15;top:90;left:10' fillcolor='#99ff33'/>  
  82. <v:rect style='height:28;width:100;top:90;left:30' stroked='false'><v:textbox    
  83.   
  84. style='fontsize:2'>c#写的.netWEB程序</v:textbox/></v:rect>  
  85. <v:rect style='height:10;width:15;top:120;left:10' fillcolor='#ff6600'/>  
  86. <v:rect style='height:28;width:100;top:120;left:30' stroked='false'><v:textbox style='fontsize:2'>vb.net   
  87.   
  88. 写的.netWEB程序</v:textbox/></v:rect>  
  89. <v:rect style='height:10;width:15;top:150;left:10' fillcolor='#ff99ff'/>  
  90. <v:rect style='height:28;width:100;top:150;left:30' stroked='false'><v:textbox style='fontsize:2'>xml技术   
  91.   
  92. </v:textbox/></v:rect>  
  93. </v:group>  
  94.   
  95. <div style="position: absolute; left: 10; top: 10; width: 760; height:16">  
  96.  <table border="1" cellpadding="2" cellspacing="2" cellpadding="0" cellspacing="0"    
  97.   
  98. style="border-collapse: collapse" bordercolor="#CCCCCC" width="100%" ID="Table1">  
  99.   <tr>  
  100.    <td width="100%" id=div1> </td>  
  101.   </tr>  
  102.  </table>  
  103. </div>//   
  104.   
  105. 102.是一个特殊的容器,想装个网页都行   
  106. <button><iframe src="http://www.google.com/"></iframe></button>//button    
  107.   
  108. 103.外部的html代码   
  109. event.srcElement.outerHTML//   
  110.   
  111. 104.标识当前的IE事件的触发器   
  112. event.srcElement和event.keyCode//   
  113.   
  114. 105.事件类型   
  115. event.type//   
  116.   
  117. 106.动态改变类型   
  118. <style>  
  119. .Overnone { border-width:0;background-color:darkblue;cursor:default;color:gold;width:115}   
  120. .Outnone   {border-width:0;background-color:white;cursor:default;width:115}   
  121. </style>  
  122. <input class=Outnone onmouseover=this.className='Overnone' >//   
  123.   
  124. 107.页面翻转   
  125. <html dir=rtl></html>//   
  126.   
  127. 108.滚屏   
  128. parent.scroll(x,y);//   
  129. <body onload="s=0" onDblClick="s=setInterval('scrollBy(0, 1)',10)" onClick="clearInterval(s)">//   
  130.   
  131. 109.改变状态栏   
  132. self.status ="";//   
  133.   
  134. 110.改变窗口大小   
  135. window.resizeTo(200,300);//   
  136.   
  137. 111.改变鼠标样式   
  138. style   
  139. BODY{CURSOR: url('mouse.ani');   
  140. SCROLLBAR-BASE-COLOR: #506AA8;    
  141. SCROLLBAR-ARROW-COLOR: #14213F;   
  142. }//   
  143.   
  144. 112.背景透明   
  145. <input type="button" value="Button" style="background-color: transparent; border: 0;">//   
  146.   
  147. 113.鼠标为等待形状   
  148. <input type=button onclick="this.style.cursor='wait'">//   
  149.   
  150. 114.调用父窗口的函数   
  151. opener.fucntion1();//   
  152.   
  153. 115.body的内部html代码   
  154. <input type="button" onclick="alert(code.document.body.innerHTML)" value="查看">//   
  155.   
  156. 116.框架中调用父窗口的函数   
  157. <INPUT TYPE='button' onclick='parent.test();' value='调用parent窗口的函数'>//   
  158.   
  159. 117.交换节点   
  160. <table  width=200  height=200  border>  
  161. <tr><td  id=c1>CELL_1</td></tr>  
  162. <tr><td  id=c2>CELL_2</td></tr>  
  163. </table>  
  164. <br>  
  165. <input  type="button"  value="swap  row"  onclick="c1.swapNode(c2)">//   
  166.   
  167. 118.删除节点   
  168. <table  width=200  height=200  border>  
  169. <tr id=trall><td  id=c1>CELL_1</td></tr>  
  170. <tr><td  id=c2>CELL_2</td></tr>  
  171. </table>  
  172. <br>  
  173. <input  type="button"  value="swap  row"  onclick="trall.removeNode(c2)">//   
  174.   
  175. 119.添加节点   
  176. addNode()//   
  177.   
  178. 120.获得事件的父与子标签   
  179. event.srcElement.children[0]和event.srcElement.parentElement //   
  180.   
  181.     
  182. 121.集中为按钮改变颜色   
  183. <style>  
  184. button{benc:expression(this.onfocus = function(){this.style.backgroundColor='#E5F0FF';})}   
  185. </style>  
  186. <button>New</button>//   
  187.   
  188.   
  189. 122.判断是左键还是右键被按下   
  190. <body onmousedown=if(event.button==1)alert("左键");if(event.button==2)alert("右键")>//   
  191.   
  192. 123.获得操作系统的名称和浏览器的名称   
  193. document.write(navigator.userAgent)//   
  194.   
  195.     
  196. 124.alt/ctrl/shift键按下   
  197. event.altKey //按下alt键   
  198. event.ctrlKey //按下ctrl键   
  199. event.shiftKey //按下shift键   
  200.   
  201.     
  202.   
  203. 125.将当前位置定位为C盘。   
  204. {window.location="c:"}//   
  205.   
  206. 126.返回输入框的类型   
  207. <script>  
  208. alert(event.srcElement.type);//   
  209. </script>  
  210.   
  211. 127.模拟控件的单击事件   
  212. <INPUT TYPE="hidden" name="guoguo" onclick="haha()">  
  213. <SCRIPT LANGUAGE="JavaScript">  
  214. <!--   
  215.   
  216. function haha()   
  217. {   
  218.  alert();   
  219. }   
  220. guoguo.click();   
  221. //-->  
  222. </SCRIPT>//   
  223.   
  224.     
  225. 128.取出记录集的列名   
  226. java.sql.ResultSet rset = com.bsitc.util.DBAssist.getIT().executeQuery(queryStatement, conn);   
  227. java.sql.ResultSetMetaData metaData = rset.getMetaData();   
  228. int count = metaData.getColumnCount();   
  229. String name = metaData.getColumnName(i);   
  230. String value = rset.getString(i);//   
  231.   
  232. 129.格式化数字   
  233. function format_number(str,digit)   
  234. {   
  235.  if(isNaN(str))   
  236.  {   
  237.   alert("您传入的值不是数字!");   
  238.   return 0;   
  239.  }   
  240.  else if(Math.round(digit)!=digit)   
  241.  {   
  242.   alert("您输入的小数位数不是整数!");   
  243.   return 0;   
  244.  }   
  245.  else    
  246.   return Math.round(parseFloat(str)*Math.pow(10,digit))/Math.pow(10,digit);   
  247. }   
  248.   
  249. 130.回车按钮转化为tab按钮   
  250. if(event.keyCode==13) event.keyCode=9; //将   
  251.   
  252.     
  253. 131.滚动条滚动   
  254. <button onclick="text1.scrollTop=text1.scrollHeight">Scroll</button><br>  
  255. <textarea id="text1" cols=50 rows=10>  
  256. 1   
  257. 1   
  258. 1   
  259. 1   
  260. 1   
  261. 1   
  262. 1   
  263. 1   
  264. 1   
  265. 1   
  266. 1   
  267. 1   
  268. 1   
  269. 1   
  270. 1   
  271. </textarea>//   
  272.   
  273.     
  274. 132.判断是什么对象   
  275. if(typeof(unknown)=="function")return true;   
  276. if(typeof(unknown)!="object")return false;//   
  277.   
  278.     
  279. 133.取消文本框自动完成功能   
  280. <input type="text" autocomplete="off"> //   
  281.   
  282. 134.让下拉框自动下拉   
  283. <select onmouseover="javascript:this.size=this.length" onmouseout="javascript:this.size=1">  
  284. <option value="">1</option>  
  285. <option value="">2</option>  
  286. <option value="">3</option>  
  287. </select> //   
  288.   
  289.     
  290. 135.读取XML文件   
  291. var childrenobj=myselect//document.all.myselect;   
  292.     var oXMLDoc = new ActiveXObject('MSXML');   
  293.     oXMLDoc.url = "mymsg.xml";   
  294.     var oRoot=oXMLDoc.root;   
  295.     if(oRoot.children != null)    
  296.  {   
  297.         for(var i=0;i<oRoot.children.item(0).children.length;++i)   
  298.   {   
  299.             oItem = oRoot.children.item(0).children.item(i);   
  300.             oOption = new Option(oItem.text,oItem.value);   
  301.    childrenobj.add(oOption);   
  302.         }   
  303.     }   
  304. //mymsg.xml文件   
  305. <?xml version="1.0" encoding="gb2312" ?>  
  306. <childrenlist>  
  307. <aa>  
  308. <child value='3301'>杭州地区</child>  
  309.   
  310. <child value='3303'>温州地区</child>  
  311.   
  312. </aa>  
  313. <aa>  
  314. <child value='3310'>台州地区</child>  
  315.   
  316. <child value='3311'>丽水地区</child>  
  317. </aa>  
  318. </childrenlist>//   
  319.   
  320.     
  321. 136.点击图片,图片停止   
  322. <a href="javascript:"><img src="http://www.51js.com/images/51js/red_forum.gif" border="0"></a>//   
  323.   
  324. 137.显示本地计算机信息   
  325. var WshNetwork = new ActiveXObject("WScript.Network");   
  326. alert("Domain = " + WshNetwork.UserDomain);   
  327. alert("Computer Name = " + WshNetwork.ComputerName);   
  328. alert("User Name = " + WshNetwork.UserName);//   
  329.   
  330.     
  331. 138.比较时间   
  332.   tDate = new Date(2004,01,08,14,35); //年,月,日,时,分   
  333.   dDate = new Date();   
  334.   tDate<dDate?alert("早于"):alert("晚于");//   
  335.   
  336. 139.弹出鼠标所在处的链结地址   
  337.   <body onmouseover="if (event.srcElement.tagName=='A')alert(event.srcElement.href)"><a    
  338.   
  339. href="http://51js.com/viewthread.php?tid=13589" >dddd</a><input>//   
  340.   
  341. 140.注意不能通过与 undefined 做比较来测试一个变量是否存在,虽然可以检查它的类型是否为“undefined”。在以   
  342.   
  343. 下的代码范例中,假设程序员想测试是否已经声明变量 x :   
  344. // 这种方法不起作用   
  345. if (x == undefined)   
  346.     // 作某些操作   
  347. // 这个方法同样不起作用- 必须检查   
  348.   
  349.   
  350. // 字符串 "undefined"   
  351. if (typeof(x) == undefined)   
  352.     // 作某些操作   
  353. // 这个方法有效   
  354. if (typeof(x) == "undefined")   
  355.     // 作某些操作   
  356.   
  357. 141.创建具有某些属性的对象   
  358. var myObject = new Object();   
  359. myObject.name = "James";   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值