PDA

View Full Version : java đánh lộn java làm sao đây



thien_long46
11-11-2006, 19:47
chào mọi người
em tạo trang web bằng Fron page có 2 frame
nhưng khi nhúng 2 hiệu ứng Java khác nha vào 2 frame(mõi frame 1 cái) thì chỉ có 1 cái chạy được em đã thử những hiệu ứng Java khác cũng vậy
điều này cũng xãy ra khi em dùng 1 hiệu ứng Java và 1 hiệu ứng chạy text trong Fron page
xin chỉ cho em làm cách nào để chạy được cả 2

nohack
11-11-2006, 22:43
Nhét vào <head> của frame, đừng nhét vào <head> của trang chứa frame.

~guest
11-11-2006, 22:55
chú ý coi có cái nào yêu cầu onload trong tag body ko, mà javascript bây giờ thực sự hết thời rồi, càng dùng nhiều mấy cái javascript càng ... nhàm

conan1212
13-11-2006, 11:34
chào mọi người
em tạo trang web bằng Fron page có 2 frame
nhưng khi nhúng 2 hiệu ứng Java khác nha vào 2 frame(mõi frame 1 cái) thì chỉ có 1 cái chạy được em đã thử những hiệu ứng Java khác cũng vậy
điều này cũng xãy ra khi em dùng 1 hiệu ứng Java và 1 hiệu ứng chạy text trong Fron page
xin chỉ cho em làm cách nào để chạy được cả 2
JavaScript chứ không phải Java, hay thứ này khác nhau hoàn toàn, cần phân biệt nghe bác.
Chỉ nên chèn mấy đoạn JavaScript cần thiết thôi:
ví dụ: thời gian cho trang web,liên kết để go back, Navigation ...
Không nên quá lạm dụng, JavaScript thực thi phía Client vì vậy nó sẽ khiến bạn cảm thấy trang web bị cà tưng sao á, load xuống mấy trang dzị làm người ta mệt mỏi. --> bỏ đi xem trang khác
mà đã dùng Frame là nặng roài còn xài JavaScrip nữa thì ôi giời ơi ...

thien_long46
13-11-2006, 20:55
em là kẻ mới nhập môn mà
các bác giúp giùm em với lỡ tạo mà ko có thời gian làm lại
như bác conan1212 nói thì xài mấy cái cần thiết thôi nhưng ít nhất thì cũng xài được 2 hiệu ứng chứ .còn em chỉ nhúng 2 cái JavaScript thôi mà chỉ có chạy được 1 thì làm sao đây
có ai giúp giùm đi

~guest
13-11-2006, 22:01
bạn post 2 cái javascript đó ra đây, chứ nói như bạn thì đến "thần y" cũng potay

ongtre63
13-11-2006, 23:13
1 hiệu ứng javascript tùy vào từng cái mà có cách xử lý khác nhau. Nhưng bạn có 3 nơi cần giải quyết, đó là trong:

"<head>" ... "</head>"

"<body" ... ">"

"<body>" ... "</body>"

Có cái javascript cần phải có đủ code trong cả 3 thì nó mới chạy, có cái chỉ cần 1 thôi cũng vẫn ngon, vấn đề có thể là bạn "lượm" đc đâu đó cái đoạn code đó mà không "lượm" triệt để cũng nên.
Cũng có trường hợp cái onLoad="..." của cái nào nằm trước hay nằm sau nữa nó mới chạy (trường hợp dùng nhìu javascript trong 1 page, cái này mình bị rùi nên biết, chỉ cần thử đi thử lại các thứ tự trc sau là đc)

thien_long46
15-11-2006, 22:33
frame 1 em dùng cái này
SCRIPT LANGUAGE="JavaScript">
<!-- Begin
SmallStars = 30;
LargeStars = 10;
SmallYpos = new Array();
SmallXpos = new Array();
LargeYpos = new Array();
LargeXpos = new Array();
Smallspeed= new Array();
Largespeed= new Array();
ns=(document.layers)?1:0;
if (ns) {
for (i = 0; i < SmallStars; i++) {
document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,1,1'></LAYER>");
}
for (i = 0; i < LargeStars; i++) {
document.write("<LAYER NAME='ln"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFFF' CLIP='0,0,2,2'></LAYER>");
}
}
else {
document.write('<div style="position:absolute;top:0px;left:0px">');
document.write('<div style="position:relative">');
for (i = 0; i < SmallStars; i++) {
document.write('<div id="si" style="position:absolute;top:0;left:0;width:1px;height:1p x;background:#fffff0;font-size:1px"></div>');
}
document.write('</div>');
document.write('</div>');
document.write('<div style="position:absolute;top:0px;left:0px">');
document.write('<div style="position:relative">');
for (i = 0; i < LargeStars; i++) {
document.write('<div id="li" style="position:absolute;top:0;left:0;width:2px;height:2p x;background:#ffffff;font-size:2px"></div>');
}
document.write('</div>');
document.write('</div>');
}
WinHeight = (document.layers)?window.innerHeight:window.docume nt.body.clientHeight;
WinWidth = (document.layers)?window.innerWidth:window.documen t.body.clientWidth;
for (i = 0; i < SmallStars; i++) {
SmallYpos[i] = Math.round(Math.random() * WinHeight);
SmallXpos[i] = Math.round(Math.random() * WinWidth);
Smallspeed[i]= Math.random() * 5 + 1;
}
for (i = 0; i < LargeStars; i++) {
LargeYpos[i] = Math.round(Math.random() * WinHeight);
LargeXpos[i] = Math.round(Math.random() * WinWidth);
Largespeed[i] = Math.random() * 10 + 5;
}
function fly() {
var WinHeight = (document.layers)?window.innerHeight:window.docume nt.body.clientHeight;
var WinWidth = (document.layers)?window.innerWidth:window.documen t.body.clientWidth;
var hscrll = (document.layers)?window.pageYOffset:document.body .scrollTop;
var wscrll = (document.layers)?window.pageXOffset:document.body .scrollLeft;
for (i = 0; i < LargeStars; i++) {
LargeXpos[i] -= Largespeed[i];
if (LargeXpos[i] < -10) {
LargeXpos[i] = WinWidth;
LargeYpos[i] = Math.round(Math.random() * WinHeight);
Largespeed[i] = Math.random() * 10 + 5;
}
if (ns) {
document.layers['ln'+i].left = LargeXpos[i];
document.layers['ln'+i].top = LargeYpos[i] + hscrll;
}
else {
li[i].style.pixelLeft = LargeXpos[i];
li[i].style.pixelTop = LargeYpos[i] + hscrll;
}
}
for (i = 0; i < SmallStars; i++) {
SmallXpos[i] -= Smallspeed[i];
if (SmallXpos[i] < -10) {
SmallXpos[i] = WinWidth;
SmallYpos[i] = Math.round(Math.random()*WinHeight);
Smallspeed[i] = Math.random() * 5 + 1;
}
if (ns) {
document.layers['sn'+i].left = SmallXpos[i];
document.layers['sn'+i].top = SmallYpos[i]+hscrll;
}
else {
si[i].style.pixelLeft = SmallXpos[i];
si[i].style.pixelTop = SmallYpos[i]+hscrll;
}
}
setTimeout('fly()', 10);
}
// End -->
</script>




cái frame thứ 2 em dùng cái này
<marquee> 20 hình ảnh trong này </marquee>

chilarua
18-11-2006, 22:26
frame thứ 2 là marquee chứ đâu phải javascript (???)