Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-12-2003, 08:28 AM   PM User | #1
Crash1hd
Regular Coder

 
Join Date: Jul 2002
Location: 51° 03' -78" N -114° 05' 72" W
Posts: 617
Thanks: 0
Thanked 0 Times in 0 Posts
Crash1hd is an unknown quantity at this point
Netscape Trouble

OkI have broken the following code down and found that when I remove the position:absolute; from the id Dmenu then the mouse overs work with the preload!

Quote:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<Script Type="text/javascript">
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);

function layerObject(id,left,top) {
if (w3){
this.obj = document.getElementById(id).style;
this.obj.left = left;
this.obj.top = top;
return this.obj;
}
if(ie) {
this.obj = document.all[id].style;
this.obj.left = left;
this.obj.top = top;
return this.obj;
}
if(ns) {
this.obj = document.layers[id];
this.obj.left = left;
this.obj.top = top;
return this.obj;
}
}
function layerSetup() {
//this has to be in this order? dont know why other wise doesnt work!

DivTitle = new layerObject('DTitle', available_width/2-180, available_height*0);
DivIcntr = new layerObject('DIcntr', available_width/2-50, available_height/2-50);
DivMenu = new layerObject('DMenu', available_width/2-400, avhn);
}
</Script>
<Script Type="text/javascript">
<!--
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}
function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
LED_1_Bar_1_down = newImage("Images/LED-1-Bar-1_down.gif");
LED_2_Bar_2_down = newImage("Images/LED-2-Bar-2_down.gif");
LED_3_Bar_3_down = newImage("Images/LED-3-Bar-3_down.gif");
LED_4_Bar_4_down = newImage("Images/LED-4-Bar-4_down.gif");
LED_5_Bar_5_down = newImage("Images/LED-5-Bar-5_down.gif");
LED_6_Bar_6_down = newImage("Images/LED-6-Bar-6_down.gif");

Bar_1_down = newImage("Images/Bar-1-down.gif");
Bar_2_down = newImage("Images/Bar-2-down.gif");
Bar_3_down = newImage("Images/Bar-3-down.gif");
Bar_4_down = newImage("Images/Bar-4-down.gif");
Bar_5_down = newImage("Images/Bar-5-down.gif");
Bar_6_down = newImage("Images/Bar-6-down.gif");

Screen_Bar_1_over = newImage("Images/Screen-Bar-1_over.gif");
Screen_Bar_4_over = newImage("Images/Screen-Bar-4_over.gif");
Screen_Bar_5_over = newImage("Images/Screen-Bar-5_over.gif");
Screen_Bar_6_over = newImage("Images/Screen-Bar-6_over.gif");

preloadFlag = true;
}
}
// -->
</Script>
<Script Type="text/javascript">
function load(){
if(ns||w3) {
available_width=innerWidth;
available_height=innerHeight;
avwn=available_width-114;
avhn=available_height-114;
layerSetup();
}
if(ie) {
available_width=document.body.clientWidth;
available_height=document.body.clientHeight;
avwn=available_width-100;
avhn=available_height-110;
layerSetup();
}
}
</Script>
</head>

<body onLoad='preloadImages(); load()' onResize="
if(ns||ie||w3) {
location.reload();
}" background="Images/Star.jpg">

<div id=DTitle style='position:absolute; width:360; height:36; Z-INDEX: 1;'>
<b><font face='Black Chancery' color='#FF00FF' size='6'>Lycosideas Web Creations</font></b>
</div>

<div id=DIcntr style="position:absolute; font-family:arial; font-size:10pt; padding:5pt; width: 100; height: 100; Z-Index: 1; clip:rect(0,100,100,0); background-color:#CCCCCC; layer-background-color:#CCCCCC">
<p align=center>This is in the center and middle of the page</p>
</div>

<div id=DMenu style='position:absolute; width:800; height:112; Z-INDEX: 1;'>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=9><IMG Name="Top" SRC="Images/TopBar.gif" ALT=""></TD>
<TD><IMG SRC="Images/spacer.gif" WIDTH=1 HEIGHT=20 ALT=""></TD>
</TR>
<TR>
<TD ROWSPAN=6><IMG Name="Left" SRC="Images/Left.gif"></TD>
<TD ROWSPAN=2><IMG Name="LED_1" SRC="Images/LED-1.gif"></TD>
<TD ROWSPAN=2><A Href="#" OnMouseOver="window.status='Services'; changeImages('Screen', 'Images/Screen-Bar-1_over.gif'); return true;" OnMouseOut="window.status=''; changeImages('Screen', 'Images/Screen.gif'); return true;" OnMouseDown="changeImages('LED_1', 'Images/LED-1-Bar-1_down.gif', 'Bar_1', 'Images/Bar-1-down.gif'); return true;" onMouseUp="changeImages('LED_1', 'Images/LED-1.gif', 'Bar_1', 'Images/Bar-1.gif'); return true;"><Img Name="Bar_1" Src="Images/Bar-1.gif" Border=0 Alt="Services"></A></TD>
<TD ROWSPAN=5><IMG Name="Outer_Screen_Left" SRC="Images/Outer-Screen-Left.gif" ALT=""></TD>
<TD><IMG Name="Outer_Screen_Top" SRC="Images/Outer-Screen-Top.gif"></TD>
<TD ROWSPAN=5><IMG Name="Outer_Screen_Right" SRC="Images/Outer-Screen-Right.gif" ALT=""></TD>
<Td RowSpan=2><A Href="#" OnMouseOver="window.status='Gallery'; changeImages('Screen', 'Images/Screen-Bar-4_over.gif'); return true;" OnMouseOut="window.status=''; changeImages('Screen', 'Images/Screen.gif'); return true;" OnMouseDown="changeImages('LED_4', 'Images/LED-4-Bar-4_down.gif', 'Bar_4', 'Images/Bar-4-down.gif'); return true;" onMouseUp="changeImages('LED_4', 'Images/LED-4.gif', 'Bar_4', 'Images/Bar-4.gif'); return true;"><Img Name="Bar_4" Src="Images/Bar-4.gif" Border=0 Alt="Gallery"></A></TD>
<TD ROWSPAN=2><IMG Name="LED_4" SRC="Images/LED-4.gif"></TD>
<TD ROWSPAN=6><IMG Name="Right" SRC="Images/Right.gif"></TD>
<TD><IMG SRC="Images/spacer.gif" WIDTH=1 HEIGHT=7 ALT=""></TD>
</TR>
<TR>
<TD ROWSPAN=3><IMG Name="Screen" SRC="Images/Screen.gif"></TD>
<TD><IMG SRC="Images/spacer.gif" WIDTH=1 HEIGHT=11 ALT=""></TD>
</TR>
<TR>
<TD><IMG Name="LED_2" SRC="Images/LED-2.gif"></TD>
<Td><A Href="#" OnMouseOver="window.status='Unsed'; return true;" OnMouseOut="window.status=''" OnMouseDown="changeImages('LED_2', 'Images/LED-2-Bar-2_down.gif', 'Bar_2', 'Images/Bar-2-down.gif'); return true;" onMouseUp="changeImages('LED_2', 'Images/LED-2.gif', 'Bar_2', 'Images/Bar-2.gif'); return true;"><IMG Name="Bar_2" SRC="Images/Bar-2.gif" Border=0></A></Td>
<TD><A Href="#" OnMouseOver="window.status='Links'; changeImages('Screen', 'Images/Screen-Bar-5_over.gif'); return true;" OnMouseOut="window.status=''; changeImages('Screen', 'Images/Screen.gif'); return true;" OnMouseDown="changeImages('LED_5', 'Images/LED-5-Bar-5_down.gif', 'Bar_5', 'Images/Bar-5-down.gif'); return true;" onMouseUp="changeImages('LED_5', 'Images/LED-5.gif', 'Bar_5', 'Images/Bar-5.gif'); return true;"><Img Name="Bar_5" Src="Images/Bar-5.gif" Border=0 Alt="Links"></A></TD>
<TD><IMG Name="LED_5" SRC="Images/LED-5.gif"></TD>
<TD><IMG SRC="Images/spacer.gif" WIDTH=1 HEIGHT=18 ALT=""></TD>
</TR>
<TR>
<TD ROWSPAN=2><IMG Name="LED_3" SRC="Images/LED-3.gif"></TD>
<TD ROWSPAN=2><A Href="#" OnMouseOver="window.status='Unsed'; return true;" OnMouseOut="window.status=''" OnMouseDown="changeImages('LED_3', 'Images/LED-3-Bar-3_down.gif', 'Bar_3', 'Images/Bar-3-down.gif'); return true;" onMouseUp="changeImages('LED_3', 'Images/LED-3.gif', 'Bar_3', 'Images/Bar-3.gif'); return true;"><IMG Name="Bar_3" SRC="Images/Bar-3.gif" Border=0></A></TD>
<TD ROWSPAN=2><A Href="#" OnMouseOver="window.status='Who Are We'; changeImages('Screen', 'Images/Screen-Bar-6_over.gif'); return true;" OnMouseOut="window.status=''; changeImages('Screen', 'Images/Screen.gif'); return true;" OnMouseDown="changeImages('LED_6', 'Images/LED-6-Bar-6_down.gif', 'Bar_6', 'Images/Bar-6-down.gif'); return true;" onMouseUp="changeImages('LED_6', 'Images/LED-6.gif', 'Bar_6', 'Images/Bar-6.gif'); return true;"><Img Name="Bar_6" Src="Images/Bar-6.gif" Border=0 Alt="Who Are We"></A></TD>
<TD ROWSPAN=2><IMG Name="LED_6" SRC="Images/LED-6.gif"></TD>
<TD><IMG SRC="Images/spacer.gif" WIDTH=1 HEIGHT=15 ALT=""></TD>
</TR>
<TR>
<TD><IMG Name="Outer_Screen_Bottem" SRC="Images/Outer-Screen-Bottem.gif"></TD>
<TD><IMG SRC="spacer.gif" WIDTH=1 HEIGHT=3 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=2><IMG Name="Bottem_Left" SRC="Images/Bottem-Left.gif"></TD>
<TD COLSPAN=3><IMG Name="Speakers" SRC="Images/Speakers.gif"></TD>
<TD COLSPAN=2><IMG Name="Bottem_Right" SRC="Images/Bottem-Right.gif"></TD>
<TD><IMG SRC="Images/spacer.gif" WIDTH=1 HEIGHT=36 ALT=""></TD>
</TR>
</TABLE>
</div>
</body></html>
What can I do!
Crash1hd is offline   Reply With Quote
Old 03-12-2003, 09:47 AM   PM User | #2
Crash1hd
Regular Coder

 
Join Date: Jul 2002
Location: 51° 03' -78" N -114° 05' 72" W
Posts: 617
Thanks: 0
Thanked 0 Times in 0 Posts
Crash1hd is an unknown quantity at this point
Ok Never mind I figured out a way to make it work! Lol figures isnt it always that way what I did was change the following

Quote:
function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[ changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}
to this

Quote:
function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
changeImages.arguments[i].src = changeImages.arguments[i+1];
}
}
}
removeing the red and then changing the following in the body

Quote:
<A Href="#" OnMouseOver="changeImages(document.Screen, 'Images/Screen-Bar-1_over.gif'); window.status='Services'; return true;"

<A Href="#" OnMouseOver="changeImages('Screen', 'Images/Screen-Bar-1_over.gif'); window.status='Services'; return true;"
and removing the '' around the screen

I dont know why but hey it works!

Now If I can only figure out why
Quote:
onResize="
if(ns||ie||w3) {
location.reload();
}"
doesnt work in opera??? Any thoughts
Crash1hd is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:26 AM.


Advertisement
Log in to turn off these ads.