473,320 Members | 2,071 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,320 software developers and data experts.

comments please on this code?

Hello,

The Javascript code at the URL below does work but no doubt there are
better ways of coding the app so would appreciate any comments!

http://www.micro-active.com/spa-test/spa-ng-front.htm

The first page links to a second where most of the Javascript is to be
found.

The slider code is in a file called slider.js which is in the same
folder and can be downloaded if required ...

After the last questions have been answered the slider values are
emailed to me using formmail-nms.cgi.

Look forward to hearing of any (many!) possible improvements etc.

Many thanks,

Geoff
Oct 15 '05 #1
10 1468
On Sat, 15 Oct 2005 14:41:48 GMT, Geoff Cox
<ge*******@notquitecorrectfreeuk.com> wrote:
Hello,

The Javascript code at the URL below does work but no doubt there are
better ways of coding the app so would appreciate any comments!

http://www.micro-active.com/spa-test/spa-ng-front.htm

The first page links to a second where most of the Javascript is to be
found.

The slider code is in a file called slider.js which is in the same
folder and can be downloaded if required ...


I should have added that the questions are in a file called
questions.js in the same folder and this file too can also be
downloaded if interested.

Cheers

Geoff
Oct 15 '05 #2

"Geoff Cox" <ge*******@notquitecorrectfreeuk.com> wrote in message
news:8m********************************@4ax.com...
On Sat, 15 Oct 2005 14:41:48 GMT, Geoff Cox
<ge*******@notquitecorrectfreeuk.com> wrote:
Hello,

The Javascript code at the URL below does work but no doubt there are
better ways of coding the app so would appreciate any comments!

http://www.micro-active.com/spa-test/spa-ng-front.htm

The first page links to a second where most of the Javascript is to be
found.

The slider code is in a file called slider.js which is in the same
folder and can be downloaded if required ...
I should have added that the questions are in a file called
questions.js in the same folder and this file too can also be
downloaded if interested.

where do the questions appera on the page ? There is a heading and a bunch
of responses but what are the questions ?

Fist page the slider bit doesn't float in teh right place - have you tested
on different res ? Cheers

Geoff

Oct 15 '05 #3
On Sat, 15 Oct 2005 17:36:07 GMT, "Zoe Brown"
<zo***********@N-O-S-P-A-A-Mtesco.net> wrote:
where do the questions appera on the page ? There is a heading and a bunch
of responses but what are the questions ?
Zoe,

when I said questions I should have said opposing or polar statements.
The first set being

"I would often be in this situation" and

"I would hardly ever be in this situation"
Fist page the slider bit doesn't float in teh right place - have you tested
on different res ?


it seems that if the browser window is maximised the thumb is in the
correct place. Do you find this?

Geoff



Cheers

Geoff


Oct 15 '05 #4

"Geoff Cox" <ge*******@notquitecorrectfreeuk.com> wrote in message
news:a1********************************@4ax.com...
On Sat, 15 Oct 2005 17:36:07 GMT, "Zoe Brown"
<zo***********@N-O-S-P-A-A-Mtesco.net> wrote:
where do the questions appera on the page ? There is a heading and a
bunch
of responses but what are the questions ?
Zoe,

when I said questions I should have said opposing or polar statements.
The first set being

"I would often be in this situation" and

"I would hardly ever be in this situation"


what situation ?
Fist page the slider bit doesn't float in teh right place - have you
tested
on different res ?


it seems that if the browser window is maximised the thumb is in the
correct place. Do you find this?


no, only when it was set to 800 * 600
Oct 15 '05 #5
On Sat, 15 Oct 2005 20:22:06 GMT, "Zoe Brown"
<zo***********@N-O-S-P-A-A-Mtesco.net> wrote:
"I would often be in this situation" and

"I would hardly ever be in this situation"


what situation ?


Zoe,

"the situation" refers to the context shown by the image, eg with
friends, with parents etc.
Fist page the slider bit doesn't float in teh right place - have you
tested
on different res ?


it seems that if the browser window is maximised the thumb is in the
correct place. Do you find this?


no, only when it was set to 800 * 600


It is fine with IE (v6) at 1024 x 768 for me but the thumb is at the
left hand end of the slider rail rather than in the middle when I use
Firefox at this resolution.

Which browser are you using?

Cheers

Geoff

Oct 15 '05 #6
Geoff Cox wrote:
Hello,

The Javascript code at the URL below does work but no doubt there are
better ways of coding the app so would appreciate any comments!

http://www.micro-active.com/spa-test/spa-ng-front.htm

The first page links to a second where most of the Javascript is to be
found.

The slider code is in a file called slider.js which is in the same
folder and can be downloaded if required ...

After the last questions have been answered the slider values are
emailed to me using formmail-nms.cgi.

Look forward to hearing of any (many!) possible improvements etc.

Many thanks,

Geoff


Your 'sliders' only work properly when the window is at 1024 pixels
wide, reducing the window width causes the range of of the marker to be
misaligned with the slider.

There is an awful lot of repetitive code that could be replaced with
loops and you have a lot of global variables - are they all needed?

Have you thought of having the value displayed so that as the slider
moves, the selected value is visible?

I'd suggest that you look at implementing your sliders as objects, then
you only need one object that you create multiple instances of. Most of
your globals can then become properties of the object - your next step
in learning JavaScript? :-)

Wouldn't it be easier all round to use radio buttons and values from say
1 to 10? Then you'd have a form that would work without scripting.
--
Rob
Oct 16 '05 #7
On Sun, 16 Oct 2005 12:09:10 +1000, RobG <rg***@iinet.net.au> wrote:

Rob,

Thanks for looking at this - my comments follow.
Your 'sliders' only work properly when the window is at 1024 pixels
wide, reducing the window width causes the range of of the marker to be
misaligned with the slider.
Any idea why that should be so? What controls this? Presumably the

mySlider1.placeSlider()

in the slider.js library? I have looked at this but cannot see how it
works?

I'm also finding a Firefox oddity - on the first page the slider thumb
is not in the centre of the rail whereas on the second page, with
multiple sliders, all the thumbs are in the centre. I cannot see any
difference in how the sliders are created ?!

To try to understand this I have made a very simple at

http://www.micro-active.com/spa-test/slider.htm

Are you able to look at this with IE and Firefox? In IE the thumb is
in the centre of the rail - with Firefox it is on the left hand side.
Why?!
There is an awful lot of repetitive code that could be replaced with
loops and you have a lot of global variables - are they all needed?
OK - will make the loops and check the global aspect.
Have you thought of having the value displayed so that as the slider
moves, the selected value is visible?
Yes but the idea is to keep the values from the user.
I'd suggest that you look at implementing your sliders as objects, then
you only need one object that you create multiple instances of. Most of
your globals can then become properties of the object - your next step
in learning JavaScript? :-)
I thought the sliders were objects?!

var mySlider1 = new Slider( "Slider1" );

what am I missing? On the second page I have used the
Slider.isPrototype() function to simplify the creation of multiple
sliders. By the way the slider libray is the work of Christiaan Hofman
at

http://www.phys.uu.nl/~hofman/jsexp/jsviewer.html

He has been very helpful and I'm waiting for a response to my latest
email to him!
Wouldn't it be easier all round to use radio buttons and values from say
1 to 10? Then you'd have a form that would work without scripting.


again, yes it would, but the idea is to replicate online what is also
a paper based exercise which has been used for some time.

Cheers

Geoff
Oct 16 '05 #8
Geoff Cox wrote:
On Sun, 16 Oct 2005 12:09:10 +1000, RobG <rg***@iinet.net.au> wrote:

Rob,

Thanks for looking at this - my comments follow.

Your 'sliders' only work properly when the window is at 1024 pixels
wide, reducing the window width causes the range of of the marker to be
misaligned with the slider.

Any idea why that should be so? What controls this? Presumably the

mySlider1.placeSlider()

in the slider.js library? I have looked at this but cannot see how it
works?


I doesn't happen in the sample page, perhaps it's something to do with
how you are positioning the slider in your page that throws the range
calculation off.

It also doesn't handle changes to font sizes after the page loads - the
button stays where it was but the slider moves up/down the page (put
some text before the slider in your test page and change the size of it
using the browser text size controls).

I'm also finding a Firefox oddity - on the first page the slider thumb
is not in the centre of the rail whereas on the second page, with
multiple sliders, all the thumbs are in the centre. I cannot see any
difference in how the sliders are created ?!

To try to understand this I have made a very simple at

http://www.micro-active.com/spa-test/slider.htm

Are you able to look at this with IE and Firefox? In IE the thumb is
in the centre of the rail - with Firefox it is on the left hand side.
Why?!
Because when setting the position of the button the units are not
specified. Find the following line (about 404):

if (this.orientation == "h") this.button.left = pos;

add -- + 'px' -- to the end:

if (this.orientation == "h") this.button.left = pos + 'px';


There is an awful lot of repetitive code that could be replaced with
loops and you have a lot of global variables - are they all needed?

OK - will make the loops and check the global aspect.

Have you thought of having the value displayed so that as the slider
moves, the selected value is visible?

Yes but the idea is to keep the values from the user.

I'd suggest that you look at implementing your sliders as objects, then
you only need one object that you create multiple instances of. Most of
your globals can then become properties of the object - your next step
in learning JavaScript? :-)

I thought the sliders were objects?!

var mySlider1 = new Slider( "Slider1" );


Hey, they are too! I didn't look closely enough.

[...]

--
Rob
Oct 16 '05 #9
On Sun, 16 Oct 2005 22:18:05 +1000, RobG <rg***@iinet.net.au> wrote:
Are you able to look at this with IE and Firefox? In IE the thumb is
in the centre of the rail - with Firefox it is on the left hand side.
Why?!


Because when setting the position of the button the units are not
specified. Find the following line (about 404):

if (this.orientation == "h") this.button.left = pos;

add -- + 'px' -- to the end:

if (this.orientation == "h") this.button.left = pos + 'px';


Rob,

I passed on your comment to Christiaan - after which he made following
change, ie added the + 'px' to the following line

var pos = this.maxSlide * rangeValue /
(this.rightValue-this.leftValue) + this.offset + 'px';

It now works OK in both IE and Firefox

Thanks again!

Cheers

Geoff
Oct 16 '05 #10
On Sat, 15 Oct 2005 14:41:48 GMT, Geoff Cox
<ge*******@notquitecorrectfreeuk.com> wrote:

Thanks for the comments - will remove the pages now.

Cheers

Geoff
Oct 17 '05 #11

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

Similar topics

17
by: lkrubner | last post by:
I've got a PHP application that's 2 megs in size. Of that, my guess is 200k-400k is comments. Do they impose a performance hit? I've been postponing any kind of optimization, but at some point I'll...
5
by: Alex | last post by:
Hi all, We're looking at a vendor who uses the InterSystems Cache Database Platform, but our IT department has zero experience with this system. This software package will have a pivotal and...
39
by: Timex | last post by:
I want to delete all comments in .c file. Size of .c file is very big. Any good idea to do this? Please show me example code.
22
by: Adam Barr | last post by:
For a book I am working on, I have written a brief (7 page) summary of C. The intent of this is that an experienced programmer who did not know C would be able to get enough information to read and...
1
by: LellD | last post by:
It seems not unusual for me that I have special chars like < (less than) or > (greater than) in C# comments, especially in <code> sections. For instance, <code> if(a<b) c=3; </code> should be a...
98
by: tjb | last post by:
I often see code like this: /// <summary> /// Removes a node. /// </summary> /// <param name="node">The node to remove.</param> public void RemoveNode(Node node) { <...> }
28
by: Hapary | last post by:
Hello all, I remember that I saw a piece of code a few years ago, it was using a combination of both /* */ and // such that you could determine the compile type of the source code. I don't...
40
by: jacob navia | last post by:
Recently we had poor Mr "teapot" that was horrified at the heresy of lcc-win of accepting // comments. C is a nice language, and you can do anything with it, inclusive a program that transforms...
4
by: nicolenwn | last post by:
Hi, I have a database in Access that currently holds the status of a salesperson and the comments of the status. The comment is an open-ended field typed in by a user. For example, if Jonny...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.