java特效源代码 特效源码html
急求一个网页特效代码
用这个吧 可以全屏拖动的 支持FLASH引用
成都创新互联公司是一家集网站建设,崇左企业网站建设,崇左品牌网站建设,网站定制,崇左网站建设报价,网络营销,网络优化,崇左网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
script id=clientEventHandlersJS language=JScript
!--
function ad_check() {
self.onError=null;
self.onError=null;
setTimeout("ad_check()",100);
}
function Min_onclick() {
//alert(ad1.style.visibility )
ad1.style.visibility='hidden';
}
function Max_onclick() {
//alert(ad1.style.visibility )
ad1.style.visibility='visible';
}
//--
/scriptscript language=JScript
//floater.innerHTML =''
//window.alert (floater.innerHTML.length4000);
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
!-- STALKER CODE --
function heartBeat() {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelTop += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelLeft += percent;
if(NS) document.floater.left += percent;
lastScrollX = lastScrollX + percent;
}
}
//--
function checkFocus(x,y) {
stalkerx = document.floater.pageX;
stalkery = document.floater.pageY;
stalkerwidth = document.floater.clip.width;
stalkerheight = document.floater.clip.height;
if( (x stalkerx x (stalkerx+stalkerwidth)) (y stalkery y
(stalkery+stalkerheight))) return true;
else return false;
}
function grabIt(e) {
if(IE) {
whichIt = event.srcElement;
while (whichIt.id.indexOf("floater") == -1) {
whichIt = whichIt.parentElement;
if (whichIt == null) { return true; }
}
whichIt.style.pixelLeft = whichIt.offsetLeft;
whichIt.style.pixelTop = whichIt.offsetTop;
currentX = (event.clientX + document.body.scrollLeft);
currentY = (event.clientY + document.body.scrollTop);
} else {
window.captureEvents(Event.MOUSEMOVE);
if(checkFocus (e.pageX,e.pageY)) {
whichIt = document.floater;
stalkerTouchedX = e.pageX-document.floater.pageX;
StalkerTouchedY = e.pageY-document.floater.pageY;
}
}
return true;
}
function moveIt(e) {
if (whichIt == null) { return false; }
if(IE) {
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - currentX); distanceY = (newY - currentY);
currentX = newX; currentY = newY;
whichIt.style.pixelLeft += distanceX;
whichIt.style.pixelTop += distanceY;
if(whichIt.style.pixelTop document.body.scrollTop) whichIt.style.pixelTop =
document.body.scrollTop; if(whichIt.style.pixelLeft document.body.scrollLeft)
whichIt.style.pixelLeft = document.body.scrollLeft; if(whichIt.style.pixelLeft
document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20)
whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
if(whichIt.style.pixelTop document.body.offsetHeight + document.body.scrollTop -
whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight +
document.body.scrollTop - whichIt.style.pixelHeight - 5;
event.returnValue = false;
} else {
whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
if(whichIt.left 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
if(whichIt.top 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
if( (whichIt.left + whichIt.clip.width) = (window.innerWidth+self.pageXOffset-17)) whichIt.left
= ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
if( (whichIt.top + whichIt.clip.height) = (window.innerHeight+self.pageYOffset-17)) whichIt.top
= ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
return false;}
return false;
}
function dropIt() {
whichIt = null;
if(NS) window.releaseEvents (Event.MOUSEMOVE);
return true;
}
!-- DRAG DROP CODE --
if(NS) {
window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
window.onmousedown = grabIt;
window.onmousemove = moveIt;
window.onmouseup = dropIt;
}
if(IE) {
document.onmousedown = grabIt;
document.onmousemove = moveIt;
document.onmouseup = dropIt;
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
setTimeout("ad_check()",10)
/script
/div
DIV align=center id=floater style="HEIGHT: 100px; WIDTH: 343px; position:absolute; left:76px; top:126px"
TABLE bgColor=#eeeeee border=1 borderColor=#999999
cellPadding=0 cellSpacing=0
style="BORDER-COLLAPSE: collapse" width=167
TBODY
TR
TD height=20 width=167
TABLE border=0 cellPadding=0 cellSpacing=0
width="100%"
TBODY
TR
TD align=right
height=15 vAlign=bottom width="100%"
TABLE border=0 height=2 width="100%"
TR
TD height=1 align=rightFONT color=#000000 face=宋体
style="FONT-SIZE: 9pt" /FONT font
class=banner
id=Min language=javascript
onclick="return Min_onclick()"font color="#990000" style="font-size: 9pt; cursor: hand"收起/font/fontfont
class=banner
id=Min language=javascript
onclick="return Max_onclick()"FONT
color=#666666//FONTfont color="#990000" style="font-size: 9pt; cursor: hand"展开/font/font/TD
/TR/TABLE/TD/TR/TBODY/TABLE/TD/TR/TBODY/TABLE
TABLE bgColor=#eeeeee border=1 borderColor=#999999
cellPadding=2 cellSpacing=0 id=ad1
style="BORDER-COLLAPSE: collapse" width=165
TBODY
TR
TD bgColor=#eeeeee disabled height=20 width=165 P align=center
object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="" width="165" height="120"
param name="movie" value=""
param name="quality" value="high"
embed src="" quality="high" pluginspage="" type="application/x-shockwave-flash" width="165" height="120"/embed/object
/P
/TD/TR
TR
TD bgColor=#eeeeee height=20 width=310div align="left"
FONT
color=#990000 size=2font color="#666666"/font/FONT
FONT
color=#FFFFFF size=2 /FONTFONT
color=#800000 size=2蓝染惣右介/FONT/div/TD
/TR
/TBODY/TABLE
/DIV
java环境下,如何实现3D图形的自动旋转?
程序实现思路: 在javafx中Node对象有一个effect属性,可以用于实现各种特效。PerspectiveTransform特效可以使Node对象实现透视变换。因此我们可以通过计算透视变换中每个点的位置来实现3D翻转特效。
实现步骤: 1、定义FlipView对象。包含以下属性:
复制代码 代码如下:
//正面视图
public Node frontNode;
//反面视图
public Node backNode;
//是否翻转
boolean flipped = false;
//翻转角度
DoubleProperty time = new SimpleDoubleProperty(Math.PI / 2);
//正面翻转特效
PerspectiveTransform frontEffect = new PerspectiveTransform();
//反面翻转特效
PerspectiveTransform backEffect = new PerspectiveTransform();
create方法返回需要显示的内容:
复制代码 代码如下:
private void create() {
time.addListener(new ChangeListener() {
@Override
public void changed(ObservableValue? extends Number arg0,
Number arg1, Number arg2) {
setPT(frontEffect, time.get());
setPT(backEffect, time.get());
}
});
anim.getKeyFrames().addAll(frame1, frame2);
backNode.visibleProperty().bind(
Bindings.when(time.lessThan(0)).then(true).otherwise(false));
frontNode.visibleProperty().bind(
Bindings.when(time.lessThan(0)).then(false).otherwise(true));
setPT(frontEffect, time.get());
setPT(backEffect, time.get());
frontNode.setEffect(frontEffect);
backNode.setEffect(backEffect);
getChildren().addAll(backNode, frontNode);
}
以上代码需要注意的是: 随着time值的变化frontEffect和backEffect的值也会随着变换。 2、PerspectiveTransform特效的实现使用了Math.sin()和Math.cos()方法模拟3D角度变换。 具体实现如下:
复制代码 代码如下:
private void setPT(PerspectiveTransform pt, double t) {
double width = 200;
double height = 200;
double radius = width / 2;
double back = height / 10;
pt.setUlx(radius - Math.sin(t) * radius);
pt.setUly(0 - Math.cos(t) * back);
pt.setUrx(radius + Math.sin(t) * radius);
pt.setUry(0 + Math.cos(t) * back);
pt.setLrx(radius + Math.sin(t) * radius);
pt.setLry(height - Math.cos(t) * back);
pt.setLlx(radius - Math.sin(t) * radius);
pt.setLly(height + Math.cos(t) * back);
}
3、角度变换在1秒的时间内从3.14/2变换到-3.14/2。
复制代码 代码如下:
KeyFrame frame1 = new KeyFrame(Duration.ZERO, new KeyValue(time,
Math.PI / 2, Interpolator.LINEAR));
KeyFrame frame2 = new KeyFrame(Duration.seconds(1),
new EventHandler() {
@Override
public void handle(ActionEvent event) {
flipped = !flipped;
}
}, new KeyValue(time, -Math.PI / 2, Interpolator.LINEAR));
4、FlipView对象的创建:通过构造函数可以很方便的创建FlipView对象.
复制代码 代码如下:
ImageView image1 = new ImageView(new Image(getClass()
.getResourceAsStream("lion1.png")));
ImageView image2 = new ImageView(new Image(getClass()
.getResourceAsStream("lion2.png")));
FlipView flip = new FlipView(image1, image2);
随滚动条滚动的广告java实现
// 非java代码,纯HTML+JS,将下面内容粘贴到txt,然后另存为xxx.html,点击打开即可!
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
""
html xmlns="" xml:lang="en" lang="en"
head
title符合网页标准的随滚动条滚动的广告特效代码alixixi.com/title
/head
body
script type="text/javascript"
function scrollImg(){
var posX,posY;
if (window.innerHeight) {
posX = window.pageXOffset;
posY = window.pageYOffset;
}
else if (document.documentElement document.documentElement.scrollTop) {
posX = document.documentElement.scrollLeft;
posY = document.documentElement.scrollTop;
}
else if (document.body) {
posX = document.body.scrollLeft;
posY = document.body.scrollTop;
}
var ad=document.getElementById("ad");
ad.style.top=(posY+100)+"px";
ad.style.left=(posX+50)+"px";
setTimeout("scrollImg()",100);
}
/script
br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/br/
div id="ad" style="position:absolute;background:#eeeeee;width:100px;height:100px;border:1px dotted #000;line-height:100px;text-align:center"此广告位招租/div
script type="text/javascript"
scrollImg();
/script
/body
/html
JAVA在WEB上的应用——实现简易计算器 求代码
html
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title网页特效|网页特效代码(JsHtml.cn)---普通计算器代码/title
/head
body
script language="JavaScript"
!-- Hide the script from old browsers --
function compute(obj)
{obj.expr.value = eval(obj.expr.value)}
var one = '1'
var two = '2'
var three = '3'
var four = '4'
var five = '5'
var six = '6'
var seven = '7'
var eight = '8'
var nine = '9'
var zero = '0'
var plus = '+'
var minus = '-'
var multiply = '*'
var divide = '/'
var decimal = '.'
function enter(obj, string)
{obj.expr.value += string}
function clear(obj)
{obj.expr.value = ''}
// --End Hiding Here --
/script
form name="calc"
table border=1
td colspan=4input type="text" name="expr" size=30 action="compute(this.form)" tr
tdinput type="button" value=" 7 " onClick="enter(this.form, seven)"
tdinput type="button" value=" 8 " onClick="enter(this.form, eight)"
tdinput type="button" value=" 9 " onClick="enter(this.form, nine)"
tdinput type="button" value=" / " onClick="enter(this.form, divide)"
trtdinput type="button" value=" 4 " onClick="enter(this.form, four)"
tdinput type="button" value=" 5 " onClick="enter(this.form, five)"
tdinput type="button" value=" 6 " onClick="enter(this.form, six)"
tdinput type="button" value=" * " onClick="enter(this.form, multiply)"
trtdinput type="button" value=" 1 " onClick="enter(this.form, one)"
tdinput type="button" value=" 2 " onClick="enter(this.form, two)"
tdinput type="button" value=" 3 " onClick="enter(this.form, three)"
tdinput type="button" value=" - " onClick="enter(this.form, minus)"
trtd colspan=2input type="button" value=" 0 " onClick="enter(this.form, zero)"
tdinput type="button" value=" . " onClick="enter(this.form, decimal)"
tdinput type="button" value=" + " onClick="enter(this.form, plus)"
trtd colspan=2input type="button" value=" = " onClick="compute(this.form)"
td colspan=2input type="button" value="AC" size= 3 onClick="clear(this.form)" /table
/form
/body
/html
执行的结果如下图:
当前文章:java特效源代码 特效源码html
网站地址:http://azwzsj.com/article/hiejjo.html