|
List Info
Thread: class instead of id
|
|
| class instead of id |

|
2007-12-29 15:30:25 |
Hi,
I'm building an application and I need that for example,
the
"slideshow" at:
new GFslideShow(samples, "slideshow",
options);
will refer to a class. I saw it was not working for a
class.
Is there any way to do it? (using id won't be xhtml valid
since it is
a repeatable pattern.)
I know sometimes you can do "div.slideshow" but it
did not work as
well.
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Google AJAX API" group.
To post to this group, send email to
Google-AJAX-Search-API googlegroups.com
To unsubscribe from this group, send email to
Google-AJAX-Search-API-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/Google-AJAX-Search-API
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: class instead of id |

|
2007-12-30 05:25:19 |
Because there is no getElementsByClassName() functionality
in the W3C
DOM, the only way to do this would be to write your own
loop, as
follows:
var a=document.getElementsByTagName('*');
var slideshows=[];
for(var b=0;b<a.length;b++){
if(a[b].className.match(/b?
THE_CLASS_OF_THOSE_ELEMENTS_YOU_WANT_TO_BE_SLIDESHOWSb?/)){
// Make
sure to leave the b?'s
slideshows.push(new GFslideShow(samples,a[b],options));
}
}
Or you could rearrange that to make your own
getElementsByClassName
function:
function getElementsByClassName(className){
var a=document.getElementsByTagName('*');
var b=[];
for(var c=0;c<a.length;c++){
var d=new
RegExp("b?"+className+"b?")
if(a[c].className.match(d)){b.push(a[c]);}
}
return b;
}
function initSlideshows(className){
var a=getElementsByClassName(className);
window.slideshows=[];
for(var b=0;b<a.length;b++){
window.slideshows.push(new
GFslideShow(samples,a[b],options));
}
}
Jeremy R. Geerdes
Effective website design & development
Des Moines, IA
For more information or a project quote:
http://jgeerdes.home.m
chsi.com
jgeerdes mchsi.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Google AJAX API" group.
To post to this group, send email to
Google-AJAX-Search-API googlegroups.com
To unsubscribe from this group, send email to
Google-AJAX-Search-API-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/Google-AJAX-Search-API
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: class instead of id |

|
2007-12-30 12:37:56 |
Thanks a lot,
But probably I don't put any of the two options correctly.
I'll appreciate if you could help me implementing it here:
<script type="text/javascript">
function load() {
var samples = "[CUSTOM:rss]";
var options = {
displayTime: 3000,
thumbnailSize : GFslideShow.THUMBNAILS_MEDIUM,
transistionTime: 600
};
new GFslideShow(samples, "slideshow",
options);
}
google.load("feeds", "1");
google.setOnLoadCallback(load);
</script>
<div
class="slideshow">Loading...</div>
On Dec 30, 1:25 pm, "jgeerdes [AJAX APIs
"Guru"]"
<jgeer... mchsi.com> wrote:
> Because there is no getElementsByClassName()
functionality in the W3C
> DOM, the only way to do this would be to write your own
loop, as
> follows:
>
> var a=document.getElementsByTagName('*');
> var slideshows=[];
> for(var b=0;b<a.length;b++){
> if(a[b].className.match(/b?
>
THE_CLASS_OF_THOSE_ELEMENTS_YOU_WANT_TO_BE_SLIDESHOWSb?/)){
// Make
> sure to leave the b?'s
> slideshows.push(new
GFslideShow(samples,a[b],options));
> }
>
> }
>
> Or you could rearrange that to make your own
getElementsByClassName
> function:
>
> function getElementsByClassName(className){
> var a=document.getElementsByTagName('*');
> var b=[];
> for(var c=0;c<a.length;c++){
> var d=new
RegExp("b?"+className+"b?")
> if(a[c].className.match(d)){b.push(a[c]);}
> }
> return b;}
>
> function initSlideshows(className){
> var a=getElementsByClassName(className);
> window.slideshows=[];
> for(var b=0;b<a.length;b++){
> window.slideshows.push(new
GFslideShow(samples,a[b],options));
> }
>
> }
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.m
chsi.com
> jgeer... mchsi.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Google AJAX API" group.
To post to this group, send email to
Google-AJAX-Search-API googlegroups.com
To unsubscribe from this group, send email to
Google-AJAX-Search-API-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/Google-AJAX-Search-API
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: class instead of id |

|
2007-12-30 15:38:27 |
Jeremy,
I've sent you an email.
Thanks.
On Dec 30, 8:37 pm, aviavia <googleale... nukedesigners.com> wrote:
> Thanks a lot,
> But probably I don't put any of the two options
correctly.
> I'll appreciate if you could help me implementing it
here:
>
> <script type="text/javascript">
> function load() {
> var samples = "[CUSTOM:rss]";
> var options = {
> displayTime: 3000,
> thumbnailSize : GFslideShow.THUMBNAILS_MEDIUM,
> transistionTime: 600
>
> };
> new GFslideShow(samples, "slideshow",
options);
>
> }
> google.load("feeds", "1");
> google.setOnLoadCallback(load);
> </script>
> <div
class="slideshow">Loading...</div>
>
> On Dec 30, 1:25 pm, "jgeerdes [AJAX APIs
"Guru"]"
>
> <jgeer... mchsi.com> wrote:
> > Because there is no getElementsByClassName()
functionality in the W3C
> > DOM, the only way to do this would be to write
your own loop, as
> > follows:
>
> > var a=document.getElementsByTagName('*');
> > var slideshows=[];
> > for(var b=0;b<a.length;b++){
> > if(a[b].className.match(/b?
> >
THE_CLASS_OF_THOSE_ELEMENTS_YOU_WANT_TO_BE_SLIDESHOWSb?/)){
// Make
> > sure to leave the b?'s
> > slideshows.push(new
GFslideShow(samples,a[b],options));
> > }
>
> > }
>
> > Or you could rearrange that to make your own
getElementsByClassName
> > function:
>
> > function getElementsByClassName(className){
> > var a=document.getElementsByTagName('*');
> > var b=[];
> > for(var c=0;c<a.length;c++){
> > var d=new
RegExp("b?"+className+"b?")
> > if(a[c].className.match(d)){b.push(a[c]);}
> > }
> > return b;}
>
> > function initSlideshows(className){
> > var a=getElementsByClassName(className);
> > window.slideshows=[];
> > for(var b=0;b<a.length;b++){
> > window.slideshows.push(new
GFslideShow(samples,a[b],options));
> > }
>
> > }
>
> > Jeremy R. Geerdes
> > Effective website design & development
> > Des Moines, IA
>
> > For more information or a project quote:http://jgeerdes.home.m
chsi.com
> > jgeer... mchsi.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Google AJAX API" group.
To post to this group, send email to
Google-AJAX-Search-API googlegroups.com
To unsubscribe from this group, send email to
Google-AJAX-Search-API-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/Google-AJAX-Search-API
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: class instead of id |

|
2008-01-01 12:04:16 |
Hi Jeremy,
I apologize for the misunderstanding.
Did you get the other emails from me containing the correct
link?
Thanks Avi.
On Dec 30 2007, 11:38 pm, aviavia <googleale... nukedesigners.com>
wrote:
> Jeremy,
> I've sent you an email.
> Thanks.
>
> On Dec 30, 8:37 pm, aviavia <googleale... nukedesigners.com> wrote:
>
> > Thanks a lot,
> > But probably I don't put any of the two options
correctly.
> > I'll appreciate if you could help me implementing
it here:
>
> > <script type="text/javascript">
> > function load() {
> > var samples = "[CUSTOM:rss]";
> > var options = {
> > displayTime: 3000,
> > thumbnailSize :
GFslideShow.THUMBNAILS_MEDIUM,
> > transistionTime: 600
>
> > };
> > new GFslideShow(samples,
"slideshow", options);
>
> > }
> > google.load("feeds",
"1");
> > google.setOnLoadCallback(load);
> > </script>
> > <div
class="slideshow">Loading...</div>
>
> > On Dec 30, 1:25 pm, "jgeerdes [AJAX APIs
"Guru"]"
>
> > <jgeer... mchsi.com> wrote:
> > > Because there is no getElementsByClassName()
functionality in the W3C
> > > DOM, the only way to do this would be to
write your own loop, as
> > > follows:
>
> > > var a=document.getElementsByTagName('*');
> > > var slideshows=[];
> > > for(var b=0;b<a.length;b++){
> > > if(a[b].className.match(/b?
> > >
THE_CLASS_OF_THOSE_ELEMENTS_YOU_WANT_TO_BE_SLIDESHOWSb?/)){
// Make
> > > sure to leave the b?'s
> > > slideshows.push(new
GFslideShow(samples,a[b],options));
> > > }
>
> > > }
>
> > > Or you could rearrange that to make your own
getElementsByClassName
> > > function:
>
> > > function getElementsByClassName(className){
> > > var a=document.getElementsByTagName('*');
> > > var b=[];
> > > for(var c=0;c<a.length;c++){
> > > var d=new
RegExp("b?"+className+"b?")
> > > if(a[c].className.match(d)){b.push(a[c]);}
> > > }
> > > return b;}
>
> > > function initSlideshows(className){
> > > var a=getElementsByClassName(className);
> > > window.slideshows=[];
> > > for(var b=0;b<a.length;b++){
> > > window.slideshows.push(new
GFslideShow(samples,a[b],options));
> > > }
>
> > > }
>
> > > Jeremy R. Geerdes
> > > Effective website design & development
> > > Des Moines, IA
>
> > > For more information or a project quote:http://jgeerdes.home.m
chsi.com
> > > jgeer... mchsi.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Google AJAX API" group.
To post to this group, send email to
Google-AJAX-Search-API googlegroups.com
To unsubscribe from this group, send email to
Google-AJAX-Search-API-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/Google-AJAX-Search-API
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-5]
|
|