I'm new to java script. I have placed two scripts into my HTML document and only one works. If I take one out, then the other works. What am I doing wrong? The page I'm talking about is mrswaldrop.com/temp2.htm
LOL! Well, I'm old and going senile. And now blind as well. You didn't make it *INTO* a link, so I didn't notice that there was a URL in there. DOH on me.
I don't use jQuery, but I'll take a peek, anyway.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
LOL! Well, I'm old and going senile. And now blind as well. You didn't make it *INTO* a link, so I didn't notice that there was a URL in there. DOH on me.
I don't use jQuery, but I'll take a peek, anyway.
No problem, I should have linked it. Besides, I meant to put the winking smilie to let you know I was joking around.
Bring it up in Firefox. Enable Firebug debugging. Hit refresh.
WHAM.
Error: $(".slideshow").cycle is not a function
Since pretty clearly there is a cycle() function in that JS code, I'd have to guess that the problem is that $(".slideshow") isn't selecting an element or is maybe selecting more than one element.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Well, so much for that theory. I see the <div class="slideshow"> and there's only one of them.
I noticed that cycle( ) was defined as $.fn.cycle so maybe there is indeed a conflict in the definition of fn. Anyway, sorry, not a jQuery user, as I said.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
I'm no Jquery person but I think you are ref a class instead of an ID
"The plugin provides a method called cycle which is invoked on a container element. Each child element of the container becomes a "slide". Options control how and when the slides are transitioned."
You can refer to elements *EITHER* by class name or by id.
The "." prefix means class name, the "#" prefix means id. Same as in CSS.
Now, you *can* get in trouble using class name. If you use a $(".xxx") selector and you have more than one object of the classname, jQuery will try to apply the property/method/whatever to *all* those objects. And clearly there some functions where that's not going to work.
But in this case, I see only a single object of that class, and so it should work.
Personally, I would *NEVER* try to select a single object using class name, just because of the danger that you might accidentally be selecting more than one.
But jQuery says its legal, even if inadvisable.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Yeh @ #7 I saw that you wrote "maybe selecting more than one element"
so I thought he was using class name and so possibly it was causing problem --- when I ref the jquery site I saw they used an ID $('#s1') and I've used this same cycle plugin myself with an id and it worked fine. Hence my suggestion.