Дали задание,исправить программу,а не могу сообразить где,что менять.
Нужно Изменить движение окна на слева-направо, сверху-вниз, справа - налево и т.д.
картинка и код программы должны быть в 1 файле.открывать через эксплорер,выскочить разблокировать содержимое-нажмите разрешить.
вот код:
<html>
<head>
<title>....Просмотр java-скрипта....</title>
<STYLE TYPE="text/css">
<!--
A { font-family: Arial,Helvetica,sans-serif; color: #0000FF;text-decoration:underline}
A:visited { font-family: Arial,Helvetica,sans-serif; color: #0000FF}
A:hover { font-family: Arial,Helvetica,sans-serif; color: #0000FF}
-->
</STYLE>
<script>
<!--
var x,y
var marginbottom
var marginleft=0
var margintop=0
var marginright
var cliptop
var clipbottom
var clipleft
var clipright
var clippoints
var ballheight=100
var ballwidth=100
var imageheight=550
var imagewidth=500
// less is faster
var tempo=60
// horizontal move (pixels) within time unit
var stepx=100
// vertical move (pixels) within time unit
var stepy=6
var timer
// check the width and the height of the document
// gets the starting position of the ball by random
function setValues() {
if (document.all) {
marginbottom = imageheight-ballheight
marginright = imagewidth-ballwidth
document.all.ball.style.posLeft=randommaker(400)
document.all.ball.style.posTop=0
document.all.textcontent.style.posLeft=0
document.all.textcontent.style.posTop=0
document.all.ball.style.filter="alpha(opacity=0,finishopacity=100,style=2,startX=0px,startY=0px,finishX=100px,fini
shY=100px)"
moveball()
}
}
// randomfunction
function randommaker(range) {
rand=Math.floor(range*Math.random())
return rand
}
function moveball() {
checkposition()
if (document.all) {
document.all.ball.style.posLeft+=stepx
document.all.ball.style.posTop+=stepy
cliptop=document.all.ball.style.posTop
clipbottom=cliptop+ballheight
clipleft=document.all.ball.style.posLeft
clipright=clipleft+ballwidth
clippoints="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
document.all.textcontent.style.clip=clippoints
timer=setTimeout("moveball()",tempo)
}
}
function checkposition() {
if (document.all) {
if (document.all.ball.style.posLeft>=marginright) {
stepx=stepx*-1
document.all.ball.style.posLeft-=10
}
if (document.all.ball.style.posLeft<=marginleft) {
stepx=stepx*-1
document.all.ball.style.posLeft+=10
}
if (document.all.ball.style.posTop>=marginbottom) {
stepy=stepy*-1
document.all.ball.style.posTop-=10
}
if (document.all.ball.style.posTop<=margintop) {
stepy=stepy*-1
document.all.ball.style.posTop+=10
}
}
}
// - End of JavaScript - -->
</script>
</head>
<body bgColor=#eee1bc link="#008000" onLoad="setValues()">
<p align="center">
<p></p>
<DIV id="textcontent" style="position: absolute; top:-5000px; left:-5000px"><img src="zeta0212.gif" border="0"></DIV>
<DIV id="ball" style="position:absolute; top:-50px; width:100px;height:100px;background-color:weat;"></DIV>
<P><FONT size=1>
<script
language=JavaScript><!--
function closeIt() {
close();
}
// -->
</SCRIPT>
</FONT></P>
<FONT size=1><FORM>
<p align="center"><INPUT onclick=closeIt() type=button value=Закрыть!>
</FORM></FONT>
</body>
</html>
и вот картинка:
http://depositfiles.com/files/nl7qn0ehp
Замечание модератора:
Эта тема была закрыта автоматически ввиду отсутствия активности в ней на протяжении 100+ дней.
Если Вы считаете ее актуальной и хотите оставить сообщение, то воспользуйтесь кнопкой
или обратитесь к любому из модераторов.
|