标签:javascript
<span style="white-space:pre"> </span>var h = new Array()(2)指定数组前n个元素的值
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <script type="text/jscript" language="javascript"> function pp(field) { var rtn = window.showModalDialog("color.html","","dialogWidth=220px;dialogHeight=200px;status=no;help=no;scrollbars=no") if(rtn!=null) { field.style.background= rtn } return; } </script> </head> <body> <input type="text" readonly="yes" id="color" name="color" size=3 style="background:#000000" value = "" onclick = "pp(this)"> </body> </html>(2)网页拾色器color.html
<script language="javascript"> var h = new Array(6); h[0] = "FF"; h[1] = "CC"; h[2] = "99"; h[3] = "66"; h[4] = "33"; h[5] = "00"; function action(RGB) { parent.window.returnValue = "#"+RGB; window.close(); } function Mcell(R,G,B) { document.write('<td bgcolor="#'+R+G+B+'">'); document.write('<a href="#" onclick="action(\''+(R+G+B)+'\')">'); document.write('<img border=0 height=12 width=12\')"alt=\'#'+R+G+B+'\'>'); document.write('</a>'); document.write('</td>'); } function Mtr(R,B) { document.write('<tr>'); for (var i = 0; i <6; ++i) { Mcell( R , h[i] , B ); } document.write('</tr>'); } function Mtable(B) { document.write('<table cellpadding=0 cellspacing=0 border=0>'); for(var i = 0;i<6;++i) { Mtr(h[i],B); } document.write('</table>') } function Mcube() { document.write('<table cellpadding=0 cellspacing=0 border=0>'); for(var i = 0;i<6;++i) { if(i%3 == 0) { document.write('<tr>') } document.write('<td bgcolor=#000000">'); Mtable(h[i]); document.write('</td>') if(i%3==2) { document.write('</tr>') } } document.write('</table>'); } Mcube(); </script>
标签:javascript
原文地址:http://blog.csdn.net/yejinwei1220/article/details/45786663