Fancy time picker javascript problem...

M

mkhines

Hello Javascript Experts (of which I am not ! ) --

I'm trying to utilize a javascript I found on the web that allows a
user to select a time of day from a simple control. The script works
just fine in Internet Explorer (7) but doesn't work in Firefox when I
use it in my form. Firefox gives me an error (using firebug) that
says: "variablename" is not defined) where variablename is the

The odd thing about this is that the example that comes with the
script I downloaded works fine, it's only when I put it into my form
that it stops working. Even in Firefox...

Here is the code download page: http://www.java2s.com/Code/JavaScript/GUI-Components/FancyTimePicker.htm

(there is a link to download a zip file of all the stuff with the
example htm page included at the bottom of the screen)

Any ideas?

Thanks!!

Megan
 
M

mkhines

Oops I didn't finish this line

where variablename is the name of the input text field where the
script is supposed to be loaded onclick

onclick="selectTime(this,timepicker1)"

the error firefox gives is 'timepicker1 is not defined'

while IE loads the script without complaint
 
T

Tom Cole

Oops I didn't finish this line

where variablename is the name of the input text field where the
script is supposed to be loaded onclick

onclick="selectTime(this,timepicker1)"

the error firefox gives is 'timepicker1 is not defined'

while IE loads the script without complaint








- Show quoted text -

Is timepicker1 the name or id of an element? if so you should be
enclosing it in single quotes:

onclick="selectTime(this, 'timepicker1');"

If timepicker1 is an actual variable that has been assigned reference
to an object, then I think you'll need to post more code so we can see
this assignment plus the related HTML.
 
D

David Mark

Hello Javascript Experts (of which I am not ! ) --

I'm trying to utilize a javascript I found on the web that allows a
user to select a time of day from a simple control.  The script works
just fine in Internet Explorer (7) but doesn't work in Firefox when I
use it in my form.  Firefox gives me an error (using firebug) that
says: "variablename" is not defined) where variablename is the

The odd thing about this is that the example that comes with the
script I downloaded works fine, it's only when I put it into my form
that it stops working.  Even in Firefox...

Here is the code download page:  http://www.java2s.com/Code/JavaScript/GUI-Components/FancyTimePicker.htm

(there is a link to download a zip file of all the stuff with the
example htm page included at the bottom of the screen)

Any ideas?

Yes, don't use that script. The second line indicates it is from the
JS dark ages:

var ie=document.all;

It goes downhill after that:

var dom=document.getElementById;
var ns4=document.layers;

There's no need to read any further. This is clearly from the late
90's and would have been considered incompetent then. Throw it away.
The only reaaon the page exists today is to host advertising.
 
M

mkhines

OK. So I need some kind of similar form function that is a user-
friendly way (and error preventing way) for users to pick a start and
end time for a task. I haven't seen anything that is as intuitive
that a bunch of volunteers would be able to grasp without too much
training or fumbling.

Any ideas?

Is it too horrible to re-work?

Thanks,
Megan
(e-mail address removed)
 
D

Dr J R Stockton

In comp.lang.javascript message <35cf4d9b-7592-457c-9341-5fe1e29cb796@w7
g2000hsa.googlegroups.com>, Mon, 11 Aug 2008 06:58:23, mkhines
OK. So I need some kind of similar form function that is a user-
friendly way (and error preventing way) for users to pick a start and
end time for a task. I haven't seen anything that is as intuitive
that a bunch of volunteers would be able to grasp without too much
training or fumbling.

For people of normal capability, and assuming that they should be
allowed in the first instance to choose any time, the easiest and
quickest way for all concerned is to get them to type it in numerically
into an "input type-text", using the 24-hour clock. Allow arbitrary
separators, so that the time will match /(\d+)\D+(\d+)/ and check the
bracketed fields for value arithmetically.

If serving chronologically-retarded locations, you might add a set of
three radio buttons, 24-h clock / a.m. / p.m. or allow entry matching
/(\d+)\D+(\d+).*(p)/i .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top