473,386 Members | 1,828 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,386 software developers and data experts.

Reassigning event handler

I'm using the code shown below which displays 3 input fields - when you
click on an input field, a DIV is displayed which allows you to select a
task. On clicking the task, it is inserted into the appropriate input field,
and the DIV is hidden again.

I'm using a tooltip script from Dynamic Drive (ommitted for clarity) to show
the task description over the input field, but I am unable to reassign a new
function to the onmouseover event handler of the input field using ...

document.forms["timesheet"].elements[fld].onmouseover=ddrive(tip,300);

Can anyone tell me why this doesn't work (and how to make it work!)?

-----------------------------------------
Rae MacLeman
in**@cobwebbery.co.uk
Cobwebbery Web Design

================================================== =====
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Timesheet Data Capture Demo</title>
<script language="JavaScript" type="text/javascript">
<!--
var fld = '';

function setFld(f){
fld = f;
}
function setTip(fld,tip){
document.forms["timesheet"].elements[fld].onmouseover=ddrive(tip,300);
}
-->
</script>

</head>

<body>

<!-- Create the task picker -->
<div id="picker" style="border: 1px solid red; background-color: #F0F8FF;
padding: 5px; width:260px; visibility: hidden;">
<span style="cursor: hand;"
onclick="document.getElementById(fld).value='Task0 01';document.getElementByI
d('picker').style.visibility='hidden';setTip(fld,' Overhaul brakes');">Task
001 - Overhaul braking system</span><br>
<span style="cursor: hand;"
onclick="document.getElementById(fld).value='Task0 02';document.getElementByI
d('picker').style.visibility='hidden';">Task 002 - Full service up to
1000cc</span><br>
<span style="cursor: hand;"
onclick="document.getElementById(fld).value='Task0 03';document.getElementByI
d('picker').style.visibility='hidden';">Task 003 - Full service
1001-2000cc</span><br>
<span style="cursor: hand;"
onclick="document.getElementById(fld).value='Task0 04';document.getElementByI
d('picker').style.visibility='hidden';">Task 004 - Camshaft
replacement</span><br>
</div>

<!-- The data capture form -->
<form action="" name="timesheet" id="timesheet">
<input onMouseover="ddrivetip('unavailable', 300)";
onMouseout="hideddrivetip()" style="cursor:help;" type="text" name="task1"
id="task1"
onclick="setFld('task1');document.getElementById(' picker').style.visibility=
'visible';"><br>
<input style="cursor:help;" type="text" name="task2" id="task2"
onclick="setFld('task2');document.getElementById(' picker').style.visibility=
'visible';"><br>
<input style="cursor:help;" type="text" name="task3" id="task3"
onclick="setFld('task3');document.getElementById(' picker').style.visibility=
'visible';"><br>
</form>

</body>
</html>

--

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.794 / Virus Database: 538 - Release Date: 11/10/04
Jul 23 '05 #1
2 1403
"webdev" <so*****@microsofdt.com> wrote in message news:<11****************@doris.uk.clara.net>...
I'm using the code shown below which displays 3 input fields - when you
click on an input field, a DIV is displayed which allows you to select a
task. On clicking the task, it is inserted into the appropriate input field,
and the DIV is hidden again.

I'm using a tooltip script from Dynamic Drive (ommitted for clarity) to show
the task description over the input field, but I am unable to reassign a new
function to the onmouseover event handler of the input field using ...

document.forms["timesheet"].elements[fld].onmouseover=ddrive(tip,300);

Can anyone tell me why this doesn't work (and how to make it work!)?

-----------------------------------------
Rae MacLeman
in**@cobwebbery.co.uk
Cobwebbery Web Design

================================================== =====
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Timesheet Data Capture Demo</title>
<script language="JavaScript" type="text/javascript">
<!--
var fld = '';

function setFld(f){
fld = f;
}
function setTip(fld,tip){
document.forms["timesheet"].elements[fld].onmouseover=ddrive(tip,300);
}
-->
</script>

</head>

<body>

<!-- Create the task picker -->
<div id="picker" style="border: 1px solid red; background-color: #F0F8FF;
padding: 5px; width:260px; visibility: hidden;">
<span style="cursor: hand;"
onclick="document.getElementById(fld).value='Task0 01';document.getElementByI
d('picker').style.visibility='hidden';setTip(fld,' Overhaul brakes');">Task
001 - Overhaul braking system</span><br>
<span style="cursor: hand;"
onclick="document.getElementById(fld).value='Task0 02';document.getElementByI
d('picker').style.visibility='hidden';">Task 002 - Full service up to
1000cc</span><br>
<span style="cursor: hand;"
onclick="document.getElementById(fld).value='Task0 03';document.getElementByI
d('picker').style.visibility='hidden';">Task 003 - Full service
1001-2000cc</span><br>
<span style="cursor: hand;"
onclick="document.getElementById(fld).value='Task0 04';document.getElementByI
d('picker').style.visibility='hidden';">Task 004 - Camshaft
replacement</span><br>
</div>

<!-- The data capture form -->
<form action="" name="timesheet" id="timesheet">
<input onMouseover="ddrivetip('unavailable', 300)";
onMouseout="hideddrivetip()" style="cursor:help;" type="text" name="task1"
id="task1"
onclick="setFld('task1');document.getElementById(' picker').style.visibility=
'visible';"><br>
<input style="cursor:help;" type="text" name="task2" id="task2"
onclick="setFld('task2');document.getElementById(' picker').style.visibility=
'visible';"><br>
<input style="cursor:help;" type="text" name="task3" id="task3"
onclick="setFld('task3');document.getElementById(' picker').style.visibility=
'visible';"><br>
</form>

</body>
</html>

--

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.794 / Virus Database: 538 - Release Date: 11/10/04

Should really use document.getElementById()...

document.forms["timesheet"].elements[fld].onmouseover= function()
{
ddrive(tip,300);
}

Don't want the handler called while assigning.
Jul 23 '05 #2

"RobB" <fe******@hotmail.com> wrote in message
news:ab**************************@posting.google.c om...
"webdev" <so*****@microsofdt.com> wrote in message

news:<11****************@doris.uk.clara.net>...
I'm using the code shown below which displays 3 input fields - when you
click on an input field, a DIV is displayed which allows you to select a
task. On clicking the task, it is inserted into the appropriate input field, and the DIV is hidden again.

I'm using a tooltip script from Dynamic Drive (ommitted for clarity) to show the task description over the input field, but I am unable to reassign a new function to the onmouseover event handler of the input field using ...

document.forms["timesheet"].elements[fld].onmouseover=ddrive(tip,300);
Can anyone tell me why this doesn't work (and how to make it work!)?

-----------------------------------------
Rae MacLeman
in**@cobwebbery.co.uk
Cobwebbery Web Design
[ === SCRIPT REMOVED ===]
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.794 / Virus Database: 538 - Release Date: 11/10/04

Should really use document.getElementById()...

document.forms["timesheet"].elements[fld].onmouseover= function()
{
ddrive(tip,300);
}

Don't want the handler called while assigning.

Works now. many thanks RobB!


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.794 / Virus Database: 538 - Release Date: 11/10/04
Jul 23 '05 #3

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

Similar topics

9
by: Ken Godee | last post by:
I'm using the python Queue module, but since I can not find anyway to clear the Queue, I thought I would try to reassign ie...... q1 = Queue.Queue() q1.put('test1') q1.put('test2') q1.qsize()...
10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
6
by: vbMark | last post by:
If I have a control, for example a CheckedListBox, how do I add and event to code, for example that a box has been checked by the user? Thanks
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
3
by: Beth | last post by:
in the following: this.ExitButton.Click += new System.EventHandler(this.ExitButton_Click); if I saw an equation, such as y +=x; then y = y+x. But what is the meaning in the event handler. I...
5
by: Richard Grant | last post by:
Hi, I need to "save" in a variable the event handler sub of a control's event, then perform some process, and finally "restore" the originally saved event handler. Example in pseudo-code: 1)...
1
by: tdan | last post by:
I do not know how to get Event.stopObserving() to work in the context I am using it. I am displaying a Color Selection Table and attaching 2 events: 1. onmouseover to display the color to the user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.