完美

[学习|工作|博客|交流平台|完美起航]

作者头像admin2017.05.11 15:52 

java之九九乘法表的输出

九九乘法表输出,代码如下:packagecode; /** * *@authorSmart * */ publicclassMultiply{ publicstaticvoidmain(String[]args) { inti,j; for(i=1;i<10;i++){ for(j=1;j<=i;j++){ System.out.print(j+"*"+i+"="+i*j+"\t"); } System.out.println(""); } } }输出结果如下:1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3=9 1*4=4 2*4=8 3*4=12 4*4=16 1*5=5 2*5=10 3*5=15 4*5=20 5*5=25 1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36 1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49 1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64 1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81

java 36472 9

作者头像admin2017.06.01 11:50 

java之password组件的使用

java之password组件的使用frames.javapackagepasswd; importjava.awt.*; importjava.awt.event.*; importjavax.swing.*; importcom.borland.jbcl.layout.*; /** *<p>Title:</p> *<p>Description:</p> *<p>Copyright:Copyright(c)2017</p> *<p>Company:</p> *@authorsmart *@version1.0 */ publicclassFramesextendsJFrame{ JPanelcontentPane; XYLayoutxYLayout1=newXYLayout(); Panelpanel1=newPanel(); Panelpanel2=newPanel(); Panelpanel3=newPanel(); Panelpanel4=newPanel(); TextFieldtextField1=newTextField(); CheckboxGroupcheckboxGroup1=newCheckboxGroup(); Checkboxcheckbox1=newCheckbox(); Checkboxcheckbox2=newCheckbox(); Labellabel1=newLabel(); TextFieldtextField2=newTextField(); Labellabel2=newLabel(); TextFieldtextField3=newTextField(); Buttonbutton1=newButton(); //Constructtheframe publicFrames() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try{ jbInit(); }catch(Exceptione){ e.printStackTrace(); } } //Componentinitialization privatevoidjbInit()throwsException { //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[YourIcon]"))); contentPane=(JPanel)this.getContentPane(); contentPane.setLayout(xYLayout1); this.setSize(newDimension(400,300)); this.setTitle("FrameTitle"); textField1.setText(""); checkbox1.setCheckboxGroup(checkboxGroup1); checkbox1.setLabe

java 3088 4

作者头像admin2017.06.01 11:48 

java之list的移除

java之list的使用frames.javapackagesmart.code.one; importjava.awt.*; importjava.awt.event.*; importjavax.swing.*; importcom.borland.jbcl.layout.*; /** *<p>Title:</p> *<p>Description:</p> *<p>Copyright:Copyright(c)2002</p> *<p>Company:</p> *@authorsmart *@version1.0 */ @SuppressWarnings("serial") publicclassFramesextendsJFrame{ JPanelcontentPane; XYLayoutxYLayout1=newXYLayout(); Listlist1=newList(); Buttonbutton1=newButton(); //Constructtheframe publicFrames() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try{ list1Init(); jbInit(); }catch(Exceptione){ e.printStackTrace(); } } //Componentinitialization privatevoidjbInit()throwsException { //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[YourIcon]"))); contentPane=(JPanel)this.getContentPane(); contentPane.setLayout(xYLayout1); this.setSize(newDimension(400,300)); this.setTitle("FrameTitle"); button1.setLabel("Delete"); button1.addActionListener(newjava.awt.event.ActionListener(){ publicvoidactionPerformed(ActionEvente){ button1_actionPerformed(e); } }); contentPane.add(list1,newXYConstraints(46,24,138,161)); contentPane.add(button1,newXYConstraints(215,45,115,40)); } //Overriddensowecanexitwhenwindowisclosed protectedvoidprocessWindowEvent(WindowEvente) { sup

java 6132 4

作者头像admin2017.06.01 11:49 

Java之JFrame的使用

Java之JFrame的使用1.Frame1.javapackagewelcome; importjava.awt.*; importjava.awt.event.*; importjavax.swing.*; importcom.borland.jbcl.layout.*; /** *<p>Title:</p> *<p>Description:</p> *<p>Copyright:Copyright(c)2017</p> *<p>Company:</p> *@authornone *@version1.0 */ publicclassFrame1extendsJFrame{ JPanelcontentPane; Labellabel1=newLabel(); XYLayoutxYLayout1=newXYLayout(); //Constructtheframe publicFrame1() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try{ jbInit(); }catch(Exceptione){ e.printStackTrace(); } } //Componentinitialization privatevoidjbInit()throwsException { //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[YourIcon]"))); contentPane=(JPanel)this.getContentPane(); label1.setFont(newjava.awt.Font("Dialog",0,20)); label1.setText("WelcometoJBuilder"); contentPane.setLayout(xYLayout1); this.setSize(newDimension(400,300)); this.setTitle("FrameTitle"); contentPane.add(label1,newXYConstraints(102,68,400,-1)); } //Overriddensowecanexitwhenwindowisclosed protectedvoidprocessWindowEvent(WindowEvente) { super.processWindowEvent(e); if(e.getID()==WindowEvent.WINDOW_CLOSING){ System.exit(0); } } }2.welcome.javapackagewelcome; importjavax.swing.UIManager; importjava.awt.*; /** *<p>Title:</p&

Java 35195 7

作者头像admin2017.06.01 11:48 

js实现左键弹出式菜单

左键弹出式菜单[推荐][修改显示的文字及链接即可][共2步]====1、将以下代码加入HEML的<head></head>之间:<styletype="text/css"> body{ font:9pt"宋体"; margintop:0px; color:#ffffff; background:#000000 } a.{ font:9pt"宋体"; cursor:hand; font-size:9pt; color:#ffffff; text-decoration:none } a:active{ font:9pt"宋体"; cursor:hand; color:#FF0033 } a.cc:hover{ font:9pt"宋体"; cursor:hand; color:#FF0033 } .box{ font:9pt"宋体"; position:absolute; background:#000000 } </style>====2、将以下代码加入到HEML的<body></body>之间:<tableid="itemopen"class="box"style="display:none"> <tr> <td>弹出菜单</td> </tr> <tr> <td><ahref="../../../index.html"class="cc">本站首页</a></td> </tr> <tr> <td><ahref="../../navigation/newscript.htm"class="cc">最新更新</a></td> </tr> <tr> <td><ahref="../../navigation/applet/appletindex.htm"class="cc">梦想软件</a></td> </tr> <tr> <td><ahref="../../../jsschool/index.htm"class="cc">桌面壁纸</a></td> </tr> <tr> <td><ahref="popmenu.htm"class="cc">更多连接</a></td> </tr> <tr> <td><ahref="popmenu.

JavaScript 2932 2

作者头像admin2017.06.01 11:48 

JavaScript推拉门式样的菜单

推拉门式样的菜单[根据提示修改][共2步]====1、将以下代码加入到HEML的<head></head>之间:<styletype="text/css"> <!-- .link{ color:#000000; text-decoration:none; } A.link:hover{ color:red; } A.link:active{ color:#000000; text-decoration:none; }//--> </style> <styletype="text/css"> <!-- #slidemenubar2{ position:absolute; left:-110pt; width:120pt; top:100pt; border:1.5ptsolidblack; background-color:#ffffff; layer-background-color:#ffffff; font:9pt/20pt"宋体"; } body{ font-size:9pt; margin:0pt } #slidemenubar{ position:absolute; left:-110pt; width:120pt; top:100pt; border:1.5ptblacksolid; background-color:#F3F3F3; layer-background-color:lightyellow; font:9pt/20pt"宋体"; } //--> </style>====2、将以下代码加入到HEML的<body></body>之间:<scriptlanguage="JavaScript1.2"> if(document.all) document.write('<divid="slidemenubar2"style="left:-100"onMouseover="pull()"onMouseout="draw()">') </script> <layerid="slidemenubar"onMouseover="pull()"onMouseout="draw()"> <scriptlanguage="JavaScript1.2"> varsitems=newArray() varsitemlinks=newArray() //以下是菜单内容,自由设置; sitems[0]="本站首页" sitems[1]="最新更新" sitems[2]="梦想软件" sitems[3]="其它栏目" sitems[4]="桌面壁纸" sitems[

JavaScript 2804 2

作者头像admin2017.06.01 11:48 

JavaScript之Dom操作

1.创建元素vardiv=document.createElement("div");//创建一个div元素2.将创建的元素添加到body里面document.body.appendChild(div);//将创建的div元素追加到body里面创建的元素不仅仅可以添加的body里面,还可以添加到指定的元素里面varspan=document.createElement("span"); div.appendChild(span);//将创建的span添加的div元素中 vardiv2=document.getElementById("div");//从html文档中根据id获取div元素 div2.appendChild(div);将创建的div添加到div2中3.给创建的元素添加样式div.style.width="200px";//宽度 div.style.height="200px";//高度 div.style.cursor="pointer";//鼠标指针样式 div.style.position="fixed";//把元素放置在static,relative,absolute或fixed的位置 div.style.zIndex="10000";//设置元素的堆叠次序 div.style.top="100px";//距离顶部的距离 div.style.left="100px";//距离左边的距离 div.style.backgroundImage=url;//背景图片 div.style.backgroundRepeat="no-repeat";//背景是否重复 div.style.backgroundPositionY="bottom";//背景向下显示支持的样式有如下:Style 对象的属性:背景边框和边距布局列表杂项定位打印滚动条表格文本规范IE: Internet Explorer, M: 仅适用于 Mac IE, W: 仅适用于 Windows IE, F: Firefox, O: OperaW3C: 万维网联盟 World Wide Web Consortium (Internet 标准).Background 属性属性描述IEFOW3Cbackground在一行中设置所有的背景属性419YesbackgroundAttachment设置背景图像是否固定或随页面滚动419YesbackgroundColor设置元素的背景颜色419YesbackgroundImage设置元素的背景图像419YesbackgroundPosition设置背景图像的起始位置4NoNoYesbackgroundPositionX设置backgroundPosition属性的X坐标4NoNoNobackgroundPositionY设置backgroundPosition属性的Y坐标4NoNoNobackgroundRepeat设置是否及如何重复背景图像419YesBorder 和 Margin 属性属性描述IEFOW3Cborder在一行设置四个边框的所有属性419

JavaScript 2676 2

作者头像admin2017.06.01 11:47 

js实现左右移动的图片

左右移动的图片[修改图片名称即可][共2步]====1、将以下代码加入到HEML的<head></head>之间:<scriptLANGUAGE="JavaScript"> <!-- step=0; obj=newImage(); functionanim(xp,xk,smer)//smer=direction { obj.style.left=x; x+=step*smer; if(x>=(xk+xp)/2){ if(smer==1) step--; else step++; }else{ if(smer==1) step++; else step--; } if(x>=xk){ x=xk; smer=-1; } if(x<=xp){ x=xp; smer=1; } //if(smer>2)smer=3; setTimeout('anim('+xp+','+xk+','+smer+')',50); } functionmoveLR(objID,movingarea_width,c){ if(navigator.appName=="Netscape") window_width=window.innerWidth; else window_width=document.body.offsetWidth; obj=document.images[objID]; image_width=obj.width; x1=obj.style.left; x=Number(x1.substring(0,x1.length-2));//30px->30 if(c==0){ if(movingarea_width==0){ right_margin=window_width-image_width; anim(x,right_margin,1); }else{ right_margin=x+movingarea_width-image_width; if(movingarea_width<x+image_width) window.alert("Nospaceformoving!"); else anim(x,right_margin,1); } }else{ if(movingarea_width==0) right_margin=window_width-image_width; else{ x=Math.round((window_width-movingarea_width)/2); right_margin=Math.round((window_width+movingarea_width)/2)-image_width; } anim(x,right_margin,1); } } //--> </script>====2、将以下代码加入到HEML的<body></body>之间:<img src="要显示的图片名称.gif" name=&q

左右移动的图片 2845 1

作者头像admin2017.05.26 15:25 

UEditor如何防止xss注入

现在的富文本编辑器,都有xss注入漏洞,想请教一下,如何防止xss注入?markdown编辑器先不考虑服务器端清除xss攻击stringhtmlentities(string$string[,int$flags=ENT_COMPAT|ENT_HTML401[,string$encoding="UTF-8"[,bool$double_encode=true]]])例子:<?php $str="A'quote'is<b>bold</b>"; //Outputs:A'quote'is&lt;b&gt;bold&lt;/b&gt; echohtmlentities($str); //Outputs:A&#039;quote&#039;is&lt;b&gt;bold&lt;/b&gt; echohtmlentities($str,ENT_QUOTES); ?><?php $str="\x8F!!!"; //Outputsanemptystring echohtmlentities($str,ENT_QUOTES,"UTF-8"); //Outputs"!!!" echohtmlentities($str,ENT_QUOTES|ENT_IGNORE,"UTF-8"); ?>stringhtmlspecialchars(string$string[,int$flags=ENT_COMPAT|ENT_HTML401[,string$encoding="UTF-8"[,bool$double_encode=true]]])<?php $new=htmlspecialchars("<ahref='test'>Test</a>",ENT_QUOTES); echo$new;//&lt;ahref=&#039;test&#039;&gt;Test&lt;/a&gt; ?>还原显示可以使用htmlspecialchars_decode、html_entity_decodestringhtmlspecialchars_decode(string$string[,int$flags=ENT_COMPAT|ENT_HTML401])<?php $str="<p>this-&gt;&quot;</p>\n"; echohtmlspecialchars_decode($str); //注意,这里的引号不会被转换 echohtmlspecialchars_decode($str,ENT_NOQUOTES); ?>以上过程会输出<p>this->"</p> <p>this->&quot;</p>stringhtml_entity_decode

UEditor 2676 3

作者头像admin2017.06.01 11:47 

PHP unpack() 函数

PHP unpack() 函数定义和用法unpack() 函数从二进制字符串对数据进行解包。语法unpack(format,data)参数描述format必需。规定在解包数据时所使用的格式。data可选。规定被解包的二进制数据。format 参数的可能值:a - NUL-padded stringA - SPACE-padded stringh - Hex string, low nibble firstH - Hex string, high nibble firstc - signed charC - unsigned chars - signed short (always 16 bit, machine byte order)S - unsigned short (always 16 bit, machine byte order)n - unsigned short (always 16 bit, big endian byte order)v - unsigned short (always 16 bit, little endian byte order)i - signed integer (machine dependent size and byte order)I - unsigned integer (machine dependent size and byte order)l - signed long (always 32 bit, machine byte order)L - unsigned long (always 32 bit, machine byte order)N - unsigned long (always 32 bit, big endian byte order)V - unsigned long (always 32 bit, little endian byte order)f - float (machine dependent size and representation)d - double (machine dependent size and representation)x - NUL byteX - Back up one byte@ - NUL-fill to absolute position例子例子 1<?php $data="PHP"; print_r(unpack("C*",$data)); ?>输出:Array ( [1]=>80 [2]=>72 [3]=>80 )例子 2<?php $data="PHP"; print_r(unpack("C*myint",$data)); ?>输出:Array ( [myint1]=>80 [myint2]=>72 [myint3]=>80 )例子 3<?php $bin=pack("c2n2",0x1234,0x5678,65,66); print_r(unpack("c2chars/n2int",$bin)); ?>输出:Array ( [chars1]=>52 [

unpack 2448 1

a6bfb44cbd5549740eb36647f36ef83a