By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,599 Members | 1,872 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,599 IT Pros & Developers. It's quick & easy.

Fancy time picker javascript problem...

P: n/a
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/JavaScrip...TimePicker.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
Aug 8 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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

On Aug 8, 10:56*am, mkhines <megan.hi...@gmail.comwrote:
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/JavaScrip...TimePicker.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
Aug 8 '08 #2

P: n/a
On Aug 8, 12:00*pm, mkhines <megan.hi...@gmail.comwrote:
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

On Aug 8, 10:56*am, mkhines <megan.hi...@gmail.comwrote:
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/JavaScrip...TimePicker.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- Hide quoted text -

- 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.
Aug 8 '08 #3

P: n/a
On Aug 8, 11:56*am, mkhines <megan.hi...@gmail.comwrote:
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/JavaScrip...TimePicker.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.
Aug 9 '08 #4

P: n/a
On Aug 9, 8:53*am, David Mark <dmark.cins...@gmail.comwrote:
On Aug 8, 11:56*am, mkhines <megan.hi...@gmail.comwrote:
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/JavaScrip...TimePicker.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?
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
me*********@gmail.com
>
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.
Aug 11 '08 #5

P: n/a
In comp.lang.javascript message <35cf4d9b-7592-457c-9341-5fe1e29cb796@w7
g2000hsa.googlegroups.com>, Mon, 11 Aug 2008 06:58:23, mkhines
<me*********@gmail.composted:
>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 .

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Aug 11 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.