以下的代码就可以,lz自己在*的地方填入星星的图片就可以了
创新互联公司专注于企业成都营销网站建设、网站重做改版、镇原网站定制设计、自适应品牌网站建设、H5页面制作、购物商城网站建设、集团公司官网建设、成都外贸网站建设公司、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为镇原等各大城市提供网站开发制作服务。
body bgcolor=#ee3300
style
.drop { position: absolute; width: 3; filter: flipV(), flipH(); font-size: 40; color: #ffffff }
/style
script language="javascript"
snow = false; // false-rain; true-snow
snowsym = " * " are the symbols for each
rainsym = " * " can put images here.
howmany = 20 many drops/snowflakes?
/**************Do not need to change anything below***********/
if(snow){sym = snowsym; speed=1; angle=10; drops=howmany}
else{sym = rainsym; speed=30; drops=howmany; angle=6}
movex = -speed/angle; movey = speed; count = 0;
function moverain(){
for(move = 0; move drops; move++){
xx[move]+=movex; yy[move]+=mv[move];
hmm = Math.round(Math.random()*1);
if(xx[move] 0){xx[move] = maxx+10;}
if(yy[move] maxy){yy[move] = 10;}
drop[move].left = xx[move]
drop[move].top = yy[move]+document.body.scrollTop;
}setTimeout('moverain()','1')}
/script
script language="javascript"
if (document.all){
drop = new Array(); xx = new Array(); yy = new Array(); mv = new Array()
ly = "document.all[\'"; st = "\'].style"
for(make = 0; make drops; make++){
document.write('div id="drop'+make+'" class=drop'+sym+'/div');
drop[make] = eval(ly+'drop'+make+st);
maxx = document.body.clientWidth-40
maxy = document.body.clientHeight-40
xx[make] = Math.random()*maxx;
yy[make] = -100-Math.random()*maxy;
drop[make].left = xx[make]
drop[make].top = yy[make]
mv[make] = (Math.random()*5)+speed/16;
drop[make].fontSize = (Math.random()*10)+20;
if(snow){col = 'white'}else{col = 'white'}
drop[make].color = col;
}
window.onload=moverain
}
/script
/body
javascript java是两种完全不同的语言也许javascrtpt的名字叫做" zzz "就不会有人糊涂了
javascrtpt 客户端脚本具有简单的面向对象特征
java 是完全的面向对象语言 运行在jvm(java虚拟机)上。也可以用来编写B\S(俗称:网页)程序
jquery是一款javascrtpt库
jsp是java server page 也就是包含java代码的网页
javascrtpt操作的是dom实现的“动态”效果 就是页面动画效果,注意这并不是真正的"动态" 这只是javascrtpt特效
jsp(java)是可以操作数据库实现动态效果(与静态页面相对,动态页面是服务器根据数据库中的内容动态生成后发送到浏览器上的)
至于jquery 我认为需要先了解一些dom知识和原生javascrtpt特征后再去学习会更好
对于jsp的话 虽然是是以java为基础 但是用到java的地方并特别不多。所以可以直接去学jsp但是有一点很总要 要先去理解面向对象的概念,封装思想等
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Test{
private JFrame frame;
private String scrolledText;
private String str ="滚动文字 Demo";
public static void main(String args[]) {
try{
Test window = new Test();
window.frame.setVisible(true);
}
catch(Exception e){
e.printStackTrace();
}
}
public Test(){
initialize();
}
private void initialize(){
frame.setBounds(100, 100, 500, 375);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel panel = new JPanel();
panel.setBackground(Color.WHITE);
panel.setLayout(new BorderLayout());
frame.getContentPane().add(panel, BorderLayout.NORTH);
final JLabel label = new JLabel();
label.setText("New JLabel");
panel.add(label);
label_scrolledText(label);
frame.addComponentListener(
new ComponentAdapter(){
public void componentResized(ComponentEvent arg0){
label_scrolledText(label);
}
});
}
public void label_scrolledText(JLabel label) {
this.scrolledText = this.str;
label.setText(scrolledText);
FontMetrics metrics = label.getFontMetrics(label.getFont());
int textW = metrics.stringWidth(label.getText());
Dimension frameSize = frame.getSize();
for (int i = 1; i = (frameSize.width - textW) / 3 - 3; i++)
scrolledText += " ";
label.setText(scrolledText);
Thread thread = new Thread(new TextChanger(label));
thread.start();
}
}
java.lang.NullPointerException
at Test.initialize(Test.java:26)
at Test.init(Test.java:23)
at Test.main(Test.java:16)