PDA

View Full Version : chữ chạy wanh màng hình


anhyeuemnhieudl
13-12-2003, 19:42
Các bạn đưa đọan java này vô web là ok :



<style type="text/css">
#supertext {
position:absolute;
left:0;
top:0;
visibility:hide;
visibility:hidden;
}

</style>

<script language="JavaScript1.2">


//1) Set message to display (HTML accepted)
var thecontent='<h2><font color="#0000FF">Welcome to myweb!</font></h2>'
//2) Set delay after which message should be hidden,
in miliseconds ('' makes it incessantly visible on the screen)
var hidetimer='';
//3) Set speed of animation (1-50), where larger is faster
var BallSpeed = 20;



///NO NEED TO EDIT BELOW THIS LINE///////////

var contentWidth;
var contentHeight;
var maxBallSpeed = 50;


var xMax;
var yMax;
var xPos = 0;
var yPos = 0;
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;
var newYDir;

function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth
yMax = document.body.clientHeight
document.all("supertext" ).style.visibility = "visible";
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight
}
else if (document.layers) {
xMax = window.innerWidth;
yMax = window.innerHeight;
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}

function moveBall() {
if (superballRunning == true) {
calculatePosition();
if (document.all) {
document.all("supertext" ).style.left = xPos + document.body.scrollLeft;
document.all("supertext" ).style.top = yPos + document.body.scrollTop;
}
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;
}
animatetext=setTimeout('moveBall()',20);
}
}

function calculatePosition() {
if (xDir == "right" ) {
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";
}
}
else if (xDir == "left" ) {
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}
if (yDir == "down" ) {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}
}
else if (yDir == "up" ) {
if (yPos < (0 + BallSpeed)) {
yDir = "down";
}
}
if (xDir == "right" ) {
xPos = xPos + BallSpeed;
}
else if (xDir == "left" ) {
xPos = xPos - BallSpeed;
}
else {
xPos = xPos;
}
if (yDir == "down" ) {
yPos = yPos + BallSpeed;
}
else if (yDir == "up" ) {
yPos = yPos - BallSpeed;
}
else {
yPos = yPos;
}
}

function hidetext(){
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)
document.supertext.visibility="hide"
clearTimeout(animatetext)
}

if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()" );
}

</script>

thieugialamhung_cantho
27-12-2003, 16:05
đại ca ơi chỉ rõ hơn được không, chứ chỉ kiểu này thì đệ bó tay thôi vào phần mềm nào để viết đoạn chương trình này đây , nhớ chỉ nhanh cho em nhé đại ca, sẵn đại ca có biết tạo hình động trong chat yahô không nếu biết thì chỉ luôn nhé cám ơn nhiều.

anhyeuemnhieudl
11-01-2004, 19:59
HiHIHi mình dã nói rỏ rồi đó đây là phần để thiết kế web dùng javascrip dể viết đoạn code này không thì copy vào thôi hihihihi

LSB_conan
14-01-2004, 12:56
hừm ...
đi đâu cũng hỏi về mấy cái chèn này cả...
mấy huynh đệ nên đi học hỏi nhiều hơn đi hen ...
à cho hỏi chữ hạy quanh màn hình là sao ...

dũng
22-05-2004, 21:12
tôi có trang web cá nhân hopthu.com đó vây copy đoạn nầy thì dán vào đâu vậy .
tôi ko biết gì về web cả làm ơn chỉ cho dễ hiễu
ma` nè sao toi dán đoạn mã nầy vào rồi thì trang web trỏ nên tum lum luôn làm ơm chỉ giúp coi http://vietbox.com/phanchidung
tôi copy roi dán vao thi dau co thay gì dau vay thi tai sao ?

anhhungthoiIrac
13-06-2004, 08:32
[SIZE=20DÒNG ĐỜI LẢ TÌNH HUYNH ĐỆ " HUYNH CHO NHỮNG DÒNG CHƯ KIỂU GÌ VẬY ĐỆ KO HIỂU GÌ HẾT VẬY CHO THẾ THÌ AO NGUI TA A`HUYNH DẠY ĐỆ MON GI NGAN GON HƠN KO?

flame dragon
14-06-2004, 21:17
cho vào phần HTML trong web hoặc forum ý đó là 1 đoạn code nên nó dài là chuyện thường tình thôi mà, có gì phải thắc mắc đâu hả huynh đài.
muốn viết java có nhiều cách lắm
nhưng đơn giản và máy nào cũng có là notepad đó
vaò mà viết lại
sau đó save có đuôi là .htm hoặc .html
thế là ok
good luck!