If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Wrong tree, sort of. Your page uses the Prototype script library and one or more of its helper script libraries (like Scriptaculous, Effects, etc.). Unless you can get your jQuery script to run in No Conflict mode, and without its jQuery library overwriting variables used by Prototype and its helpers at any point before they need to access them, it will not work.

Even in an uncluttered environment where the various script libraries are loaded in a more straightforward manner, this can be a bit challenging. I'm fairly certain it can be worked out, though the amount of coding involved may be considerable.

However, since these various libraries can pretty much all do (albeit in different ways) whatever the others can, you would be far better off, and have a much lighter weight page code wise, if you pick one and base all your script code on it rather than trying to mix them together. For example, a Prototype based slider should not be too hard to find, then you wouldn't need to worry about jQuery or it conflicting with Prototype.

The Following User Says Thank You to jscheuer1 For This Useful Post:

Thanks for the advice, you've explained it well. The jQuery slider is history. Any pointers to a free Prototype slider would be appriciated. You can see the slider working OK here (SearchBox top-right) so anyone can see what I'm trying to achieve.http://www.barlborough-first.co.uk/i..._slider_ok.htm

That should do it, assuming that is the script you were having trouble adding.

Notes: Your page is a bit overloaded with scripts. I would be looking to get rid of some, not add. Also, there are errors in css and missing scripts. I'd correct the css errors (generally by just deleting them - they aren't doing anything in most cases - just make sure they aren't browser specific first), and get rid of the script tags that pont to missing scripts.

Implies that there is either a form named ysearch, in which case - a form itself has no value. Or you have named your form 'form' and ysearch is just an element of that form, in which case the syntax is archaic, and the name of the form poorly chosen.

Yes, one could in theory combine these functions, though. The first step in doing so would be to either attach/add the functions to the forms/elements while passing the form/element to the function as an argument or making it available to the function in some other manner - Or by looping through the document.forms or the form's element collection and performing the one function on each. Once you had either of those, you could treat each form/element individually on the basis of some distinguishing characteristic, perhaps by its name.

Declaring the global keyword variable seems unnecessary. It certainly should only be declared once in any case. But my thinking is that since it appears to simply represent the empty value (albeit in an inconsistent type - it should probably be initially set to an empty string, as opposed to being left undefined), so the empty string could be used in its place in the function and it (the keyword variable) could then either be internal to the function or dropped altogether.

A basic example could be (this assumes separate forms):

Code:

(function(fs){
for(var i = 0; i < fs.length; ++i){
// do some things here based upon each form's name
// or possibly its order as it appears in the document
}
})(document.forms);

or (assuming a single form with multiple inputs):

Code:

(function(els){
for(var i = 0; i < els.length; ++i){
// do some things here based upon each form element's name
// or the order in which they appear in the form
}
})(document.forms.form.elements);

form in the above would be the name of the form, but as mentioned before it should be changed to something else. This should be a unique identifier, perhaps in this case 'searchForm'. Or one could use the bracketed number notation to select the form via its order in the document: