473,474 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Whats wrong with this?

This function is called on the onMouseOut even of a table cell for a menu.
I want it to sort of fade out but for some reason i can't get it to work.
If some one could help me out on this one i would greatly appreciate it.

function out(obj)
{
var colors = new Array(5);
colors[0]='#006666';
colors[1]='#003333';
colors[2]='#002222';
colors[3]='#001111';
colors[4]='';

for(i=0; i<5; i++)
{
setTimeout("return","200");
obj.style.backgroundColor= colors[i];
}
}

would be called like this:
<td onMouseOut="Out(this);">Something</td>

Thanks in advance.

NeoPhreak >.<
Jul 20 '05 #1
3 1173
"NeoPhreak" <ne*@neophreak.com> writes:
This function is called on the onMouseOut even of a table cell for a menu.
I want it to sort of fade out but for some reason i can't get it to work.
If some one could help me out on this one i would greatly appreciate it.
.... setTimeout("return","200");
What is this line supposed to do?
What it actually does is to schedule the execution of the statement
"return" in 200 milliseconds ... which ofcourse does nothing whatsoever.
It doesn't delay execution of the following statements at all (which is
what I guess you wanted it to).
would be called like this:
<td onMouseOut="Out(this);">Something</td>


You function is called "out" with a small "o", but this call is to a
function with a captial "O". Javascript is case sensitive.

Try this:
---
var colors = ["","#011","#022","#033","#066"];
function fade(obj) {
var ctr = colors.length-1;
function fadeStep() {
obj.style.backgroundColor = colors[ctr--];
if (colors<0) {clearInterval(tid);}
}
var tid = setInterval(fadeStep,200);
}
---

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
> var colors = new Array(5);
colors[0]='#006666';
colors[1]='#003333';
colors[2]='#002222';
colors[3]='#001111';
colors[4]='';


You should consider using the array literal notation.

var colors = ['#006666', '#003333', '#002222', '#001111', ''];

It is smaller, faster, easier, prettier.

http://www.JSON.org
Jul 20 '05 #3
Thanks guys.. got it working fine now :)

NeoPhreak >.<
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris Geerdink | last post by:
combo with PHP. what is wrong with the Javascript? else { include("mysql.php"); $query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES ('".$_POST."', '".$_POST."',...
4
by: asdf | last post by:
Hello! Can someone tell me whats wrong with this piece of code: Option Compare Database Option Explicit Sub retrieve() Dim rst As ADODB.Recordset Dim i As Integer
5
by: Alexandre Martins | last post by:
Provider=Microsoft.Jet.OLEDB.4.0;UserId=Admin;Password=teste;Data Source=C:\Inetpub\wwwroot\inktoner\dados\db_inktoner.mdb;Persist Security Info=True I can't connect in my database ! whats...
1
by: aa | last post by:
When I am reading from local disk (d:), everithing is OK, but then I am reading from map disk I am geting the this error. Whats wrong. Thanks Server Error in '/Extra' Application....
3
by: mahsa | last post by:
Hi do you know whats wrong with this code? <asp:HyperLink id="HLink_Help" runat="server" NavigateUrl='<%# "javascript:window.open('comments.aspx?id=1,width=500,height=600, scrollBars=yes');"...
1
by: '~=_Slawek_=~' | last post by:
$DOW = (jddayofweek(unixtojd(mktime(1, 1, 1, $month, $day, $year)))+6)%7; $DOW= (jddayofweek(juliantojd($month, $day, $year))+6)%7; The results are supposed to be the same, but they are not....
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
0
by: cuddles | last post by:
hi im using IBM DB2 version 8 i have a procedure that should delete an error log table DELETE FROM TABLE1.ERR_MSG_LOG WHERE DATE(CRT_S) < (CURRENT DATE - 30 DAYS); but i keep...
5
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just...
1
by: x40 | last post by:
I try to learn python thru solving some interisting problem, found google trasure hunt, write first program ( but cant find whats wrong). # Unzip the archive, then process the resulting files to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.