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

onfocus for a <select>

So, I'm fairly new to this and my code is as follows...

<script language="JavaScript>
var oldValue

function focusElement(theElement) {
oldValue = theElement.value;
return;
}
</script>
Then in the HTML, I have

<select size="1" id="ConfCommentSELECT" name="ConfCommentSELECT"
onfocus="return focusPrecedence(this);">
<option value="0"> - </option>
<option value="1">1</option>
<option value="2">2</option>
</select>

The <select> is with a <form><tr><td>, but I don't see how that would make a
difference. I started using the onchange="return blah-blah-blah(this);" and
that worked so I copied that to the onfocus. What I want to do is to
remember the value of the contents of the <select> before the user changes
it, and compare it to the new value.

However, I keep getting the following error
A Runtime Error has occurred.
Do you wish to Debug?

Line:22
Error: Object expected

What am I doing wrong ?

Thanks
Mike


Jul 20 '05 #1
2 7257
Okay, so I noticed my example code is wrong. The function called in my
"onfocus=" line is really the correct function name. The function is named
"focusElement" and the "onfocus=" DOES call this same function.

"Mike Berger" <mb***************@skypoint.com> wrote in message
news:vo************@corp.supernews.com...
So, I'm fairly new to this and my code is as follows...

<script language="JavaScript>
var oldValue

function focusElement(theElement) {
oldValue = theElement.value;
return;
}
</script>
Then in the HTML, I have

<select size="1" id="ConfCommentSELECT" name="ConfCommentSELECT"
onfocus="return focusPrecedence(this);">
<option value="0"> - </option>
<option value="1">1</option>
<option value="2">2</option>
</select>

The <select> is with a <form><tr><td>, but I don't see how that would make a difference. I started using the onchange="return blah-blah-blah(this);" and that worked so I copied that to the onfocus. What I want to do is to
remember the value of the contents of the <select> before the user changes
it, and compare it to the new value.

However, I keep getting the following error
A Runtime Error has occurred.
Do you wish to Debug?

Line:22
Error: Object expected

What am I doing wrong ?

Thanks
Mike

Jul 20 '05 #2
Okay, so they didn't have the same function name. Problem solved !!!

"Mike Berger" <mb***************@skypoint.com> wrote in message
news:vo************@corp.supernews.com...
Okay, so I noticed my example code is wrong. The function called in my
"onfocus=" line is really the correct function name. The function is named
"focusElement" and the "onfocus=" DOES call this same function.

"Mike Berger" <mb***************@skypoint.com> wrote in message
news:vo************@corp.supernews.com...
So, I'm fairly new to this and my code is as follows...

<script language="JavaScript>
var oldValue

function focusElement(theElement) {
oldValue = theElement.value;
return;
}
</script>
Then in the HTML, I have

<select size="1" id="ConfCommentSELECT" name="ConfCommentSELECT"
onfocus="return focusPrecedence(this);">
<option value="0"> - </option>
<option value="1">1</option>
<option value="2">2</option>
</select>

The <select> is with a <form><tr><td>, but I don't see how that would make
a
difference. I started using the onchange="return blah-blah-blah(this);"

and
that worked so I copied that to the onfocus. What I want to do is to
remember the value of the contents of the <select> before the user

changes it, and compare it to the new value.

However, I keep getting the following error
A Runtime Error has occurred.
Do you wish to Debug?

Line:22
Error: Object expected

What am I doing wrong ?

Thanks
Mike


Jul 20 '05 #3

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

Similar topics

2
by: Andrea | last post by:
Hi, I'm trying to emulate part of our client-server application as a web site so customers can use it, and I'm stuck when it comes to re-ordering items in a list. Basically we have a list of...
1
by: Ang Talunin | last post by:
Hey, I wondering if it's possible to retrieve all the <option>-fields from a <select> when posting a <form> to a php file Example: I've got a form like this: <form action = phpfile.php...
6
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets...
4
by: joiv | last post by:
I'm making a <select></select> with lots of <option></option>. It contains all possible options. Because of the length of the list, I also have an <input type="text">. This is what I wish to do:...
5
by: Brian Foley | last post by:
Hello, I am used to using the label tag with check boxes and radio buttons in html forms. This allows me to click on the text of the label to activate/deactivate the check box / button, rather...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
4
by: luftikus143 | last post by:
Hi there, I have a nasty little problem, as so often, only with IE. Here is an screenshot to better illustrate the problem. http://geodata.grid.unep.ch/screenshot13.png The map is clickable (to...
4
by: Man-wai Chang | last post by:
-- iTech Consulting Co., Ltd. Expert of ePOS solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288
14
mikek12004
by: mikek12004 | last post by:
In a form I have 5 elements (e.g. pictures) and I wish for the user to be able to set the order of appearance. For this I have for each picture a select box (names select1 to select5) with "please...
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: 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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.