不错的几个js

 a.html
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" >
  3. <head>
  4.     <title>无标题页</title>
  5. <script type="text/javascript"> 
  6. function openstr() 
  7. window.open("b.html","","modal=yes,width=500,height=500,resizable=no,scrollbars=no"); 
  8. }
  9. </script> 
  10. </head> 
  11. <body> 
  12. <form id="form1" name="form1" method="post" action=""> 
  13. <label> 
  14. <select name="txtselect" id="txtselect"> 
  15. </select> 
  16. </label> 
  17. <label> 
  18. <input type="button" name="Submit" value="打开子窗口" onclick="openstr()" /> 
  19. </label> 
  20. </form> 
  21. </body>
  22. </html>

b.html

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" >
  3. <head>
  4.     <title>无标题页</title>
  5. <script type="text/javascript"> 
  6. function ClickOk() 
  7. var t=document.Edit;
  8. var color=t.color.value; 
  9. if(color==null||color=="填写颜色") return(false); 
  10. var oOption = window.opener.document.createElement('OPTION'); 
  11. oOption.text=color
  12. oOption.value=color
  13. //检查浏览器类型
  14. var bname = navigator.appName;
  15. if (bname.search(/netscape/i) == 0)
  16. {
  17. window.opener.document.getElementById("txtselect").add(oOption); 
  18. }
  19. else if (bname.search(/microsoft/i) == 0)
  20. {
  21. window.opener.document.all.txtselect.add(oOption); 
  22. }
  23. else
  24. {
  25. }
  26. window.close(); 
  27. </script> 
  28. </head> 
  29. <body> 
  30. <table border="0" cellpadding="0" cellspacing="2" align="center" width="300"> 
  31. <form name="Edit" id="Edit"> 
  32. <tr> 
  33. <td width="30" align="right" height="30">color:</td> 
  34. <td height="30"><input type="text" id="color" value="填写颜色" /></td> 
  35. <td width="56" align="center" height="30"><input type="button" name="bntOk" value="确认" onclick="ClickOk()" /> </td> 
  36. </tr> 
  37. </form> 
  38. </table> 
  39. </body> 
  40. </html>

yanse.html

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>无标题文档</title>
  6. </head>
  7. <body>
  8. <script type="text/javascript">
  9. document.write("<OBJECT id=/"dlgHelper/" CLASSID=/"clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b/" width=/"0px/" height=/"0px/"></OBJECT>");
  10. var ocolorPopup = window.createPopup();
  11. var ecolorPopup=null;
  12. function colordialogmouseout(obj){
  13.   obj.style.borderColor="";
  14.   obj.bgColor="";
  15. }
  16. function colordialogmouseover(obj){
  17.   obj.style.borderColor="#0A66EE";
  18.   obj.bgColor="#EEEEEE";
  19. }
  20. function colordialogmousedown(color){
  21.   ecolorPopup.value=color;
  22.   //document.body.bgColor=color;
  23.   ocolorPopup.document.body.blur();
  24. }
  25. function colordialogmore(){
  26.   var sColor=dlgHelper.ChooseColorDlg(ecolorPopup.value);
  27.   sColorsColor = sColor.toString(16);
  28.   if (sColor.length < 6) {
  29.     var sTempString = "000000".substring(0,6-sColor.length);
  30.     sColor = sTempString.concat(sColor);
  31.   }
  32.   ecolorPopup.value="#"+sColor.toUpperCase();
  33.   //document.body.bgColor="#"+sColor.toUpperCase();
  34.   ocolorPopup.document.body.blur();
  35. }
  36. function colordialog(){
  37.   var e=event.srcElement;
  38.   e.onkeyup=colordialog;
  39.   eecolorPopup=e;
  40.   var ocbody;
  41.   var oPopBody = ocolorPopup.document.body;
  42.   var colorlist=new Array(40);
  43.   oPopBody.style.backgroundColor = "#f9f8f7";
  44.   oPopBody.style.border = "solid #999999 1px";
  45.   oPopBody.style.fontSize = "12px";
  46.   colorlist[0]="#000000";  colorlist[1]="#993300";  colorlist[2]="#333300";  colorlist[3]="#003300";
  47.   colorlist[4]="#003366";  colorlist[5]="#000080";  colorlist[6]="#333399";  colorlist[7]="#333333";
  48.   colorlist[8]="#800000";  colorlist[9]="#FF6600";  colorlist[10]="#808000";colorlist[11]="#008000";
  49.   colorlist[12]="#008080";colorlist[13]="#0000FF";colorlist[14]="#666699";colorlist[15]="#808080";
  50.   colorlist[16]="#FF0000";colorlist[17]="#FF9900";colorlist[18]="#99CC00";colorlist[19]="#339966";
  51.   colorlist[20]="#33CCCC";colorlist[21]="#3366FF";colorlist[22]="#800080";colorlist[23]="#999999";
  52.   colorlist[24]="#FF00FF";colorlist[25]="#FFCC00";colorlist[26]="#FFFF00";colorlist[27]="#00FF00";
  53.   colorlist[28]="#00FFFF";colorlist[29]="#00CCFF";colorlist[30]="#993366";colorlist[31]="#CCCCCC";
  54.   colorlist[32]="#FF99CC";colorlist[33]="#FFCC99";colorlist[34]="#FFFF99";colorlist[35]="#CCFFCC";
  55.   colorlist[36]="#CCFFFF";colorlist[37]="#99CCFF";colorlist[38]="#CC99FF";colorlist[39]="#FFFFFF";
  56.   ocbody = "";
  57.   ocbody += "<table CELLPADDING=0 CELLSPACING=3>";
  58.   ocbody += "<tr height=/"20/" width=/"20/"><td align=/"center/"><table style=/"border:1px solid #808080;/" width=/"12/" height=/"12/" bgcolor=/""+e.value+"/"><tr><td></td></tr></table></td><td bgcolor=/"eeeeee/" colspan=/"7/" style=/"font-size:12px;/" align=/"center/">当前颜色</td></tr>";
  59.   for(var i=0;i<colorlist.length;i++){
  60.     if(i%8==0)
  61.       ocbody += "<tr>";
  62.     ocbody += "<td width=/"14/" height=/"16/" style=/"border:1px solid;/" onMouseOut=/"parent.colordialogmouseout(this);/" onMouseOver=/"parent.colordialogmouseover(this);/" onMouseDown=/"parent.colordialogmousedown('"+colorlist[i]+"')/" align=/"center/" valign=/"middle/"><table style=/"border:1px solid #808080;/" width=/"12/" height=/"12/" bgcolor=/""+colorlist[i]+"/"><tr><td></td></tr></table></td>";
  63.     if(i%8==7)
  64.       ocbody += "</tr>";
  65.   }
  66.   ocbody += "<tr><td align=/"center/" height=/"22/" colspan=/"8/" onMouseOut=/"parent.colordialogmouseout(this);/" onMouseOver=/"parent.colordialogmouseover(this);/" style=/"border:1px solid;font-size:12px;cursor:default;/" onMouseDown=/"parent.colordialogmore()/">其它颜色...</td></tr>";
  67.   ocbody += "</table>";
  68.   oPopBody.innerHTML=ocbody;
  69.   ocolorPopup.show(e.offsetLeft, e.offsetTop+e.offsetHeight, 158, 147, document.body);
  70. }
  71. </script>
  72. <input name="sel1" type="text" onfocus="colordialog()">
  73. </body>
  74. </html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值