473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Variable lost with each function call - WHY?

This is my code:

<script language="JavaScript" type="text/javascript">
<!--
desc_switch = 0;
function description (desc,type) {
// onBlur
alert(desc_switch)
if (type == 3) {
desc_switch = 0;
description_area.innerHTML = desc;
}
// onFocus
else if (type == 2) {
desc_switch = 1;
description_area.innerHTML = desc;
}
// onMouseOut
else if ((type == 1) && (desc_switch == 0)) {
description_area.innerHTML = desc;
}
// onMouseOver
else {
description_area.innerHTML = desc;
desc_switch = 0;
}
}
// -->
</script>

<input type="text" name="name" maxlength="50" value="http://"
onMouseOver="description('Your',0);" onMouseOut="description('',1);"
onFocus="description('Your',2);" onBlur="description('',3);">

I would _really_ appreciate any help on this issue.

Keiron
Jul 20 '05 #1
5 1803
: This is my code:
<snip> </snip>
: <input type="text" name="name" maxlength="50" value="http://"
: onMouseOver="description('Your',0);" onMouseOut="description('',1);"
: onFocus="description('Your',2);" onBlur="description('',3);">

onFocus and onMouseOver are happening at the same time.
onBlur and onMouseOut are happening at the same time.

(in MSIE, test it in NN and you might get an other result).
Wouter

Jul 20 '05 #2

"DJ WIce" <contextmenu @ djwice.com> wrote in message
news:bv**********@news.tudelft.nl...
: This is my code:
<snip> </snip>
: <input type="text" name="name" maxlength="50" value="http://"
: onMouseOver="description('Your',0);" onMouseOut="description('',1);"
: onFocus="description('Your',2);" onBlur="description('',3);">

onFocus and onMouseOver are happening at the same time.
onBlur and onMouseOut are happening at the same time.

(in MSIE, test it in NN and you might get an other result).
Wouter


So it is possible for a function to be called at exactly the same time? It's
not necessary for all function calls to go 1 by 1?

Thanks
Jul 20 '05 #3
: > onFocus and onMouseOver are happening at the same time.
: > onBlur and onMouseOut are happening at the same time.
: >
: > (in MSIE, test it in NN and you might get an other result).
: > Wouter
:
: So it is possible for a function to be called at exactly the same time?
It's
: not necessary for all function calls to go 1 by 1?

I don't know. I'm sure that 'exactly' it shall not be.
I noticed that MSIE might 'forget' to handle the second event if it handled
the first one.
(else onmousedown and oncontextmenu would both be triggered on a right
click, that only happens in NN not in MSIE).

But why or how, I don't know. And maybe I'm just wrong.

Wouter
Jul 20 '05 #4
"Keiron Waites" <no@thanks.com> wrote in message
news:bv**********@sparta.btinternet.com...
<snip>
onFocus and onMouseOver are happening at the same time.
onBlur and onMouseOut are happening at the same time.

(in MSIE, test it in NN and you might get an other result).
Wouter


So it is possible for a function to be called at exactly the
same time? It's not necessary for all function calls to go 1
by 1?


It is not possible for events of different types to occur simultaneously
on IE browsers because they use a single global - event - property to
hold the references to the event objects. Each single event must be
fully processed (end of bubbling) before processing of the next event
can begin. Else the browser would have to put a great deal of effort
into keeping track of which event handlers were active and continually
swap the global event reference, and even then no two different event
objects could be referenced via the one global - event - property at the
same time.

Richard.
Jul 20 '05 #5
Keiron Waites wrote:
This is my code:

<script language="JavaScript" type="text/javascript">
<!--
desc_switch = 0;
function description (desc,type) {
// onBlur
alert(desc_switch)
if (type == 3) {
desc_switch = 0;
description_area.innerHTML = desc;
}
// onFocus
else if (type == 2) {
desc_switch = 1;
description_area.innerHTML = desc;
}
// onMouseOut
else if ((type == 1) && (desc_switch == 0)) {
description_area.innerHTML = desc;
}
// onMouseOver
else {
description_area.innerHTML = desc;
desc_switch = 0;
}
}
// -->
</script>

<input type="text" name="name" maxlength="50" value="http://"
onMouseOver="description('Your',0);" onMouseOut="description('',1);"
onFocus="description('Your',2);" onBlur="description('',3);">

I would _really_ appreciate any help on this issue.

Keiron


What does description_area do? I see no reference to it. If I take the
description_area lines (which my browser fails on) out, the desc_switch
does not loose it's value.

Brian

Jul 20 '05 #6

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

Similar topics

11
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option...
2
by: lou zion | last post by:
hi all, i've got a class that takes a parameterless function pointer as a parameter. i want to store that function pointer in a variable and i'm trying to figure out the syntax. i came up with...
3
by: Grant Wagner | last post by:
Given the following working code: function attributes() { var attr1 = arguments || '_'; var attr2 = arguments || '_'; return ( function (el1, el2) { var value1 = el1 + el1; var value2 = el2...
9
by: Shapper | last post by:
Hello, I am declaring a variable in my aspx.vb code as follows: Public Class catalogue Public productid As String Private Sub Page_Load ... I have an image button where I call the...
23
by: Russ Chinoy | last post by:
Hi, This may be a totally newbie question, but I'm stumped. If I have a function such as: function DoSomething(strVarName) { ..... }
5
by: strawberry | last post by:
In the function below, I'd like to extend the scope of the $table variable such that, once assigned it would become available to other parts of the function. I thought 'global $table;' would solve...
0
by: zman77 | last post by:
EDIT: -- forgot to mention... I am using Visual Studio 2005, on Win XP, on an intel machine Hi. This is my first post, though I've "lurked" for a while because I find these forums very helpful....
1
by: sap0321 | last post by:
This should be kindergarten stuff but for some reason I am having trouble with it. I do 99.9% web programming and this is the first windows app i've done in years - probably the first ever in C# ......
20
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The...
3
Atli
by: Atli | last post by:
Hi everybody. This is not so much a problem, since I have already managed to find a solution, but my solution requires the use of the eval() function, which I just hate to use. The problem is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
0
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...

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.