开发者

How to get javascript to run twice in a page?

开发者 https://www.devze.com 2023-03-25 10:03 出处:网络
I have two slideshows in one page using javascript http://www.flickrshow.com/static/scripts/flickrshow-7.2.min.js, but it only displays the first slideshow.Can javascript run twice in a page or how do

I have two slideshows in one page using javascript http://www.flickrshow.com/static/scripts/flickrshow-7.2.min.js, but it only displays the first slideshow. Can javascript run twice in a page or how do I get it to display the two slideshows?

Here is the actual page http://giantmango.com/colors-2010-2-1192. I am using this javascript http://www.flickrshow.com/static/scripts/flickrshow-7.2.min.js to display images from flickr on an iPad since flickr`s slideshow uses Flash.

<div class="theflickrshow" id="cesc">
   <p>Please enable Javascript to view this slideshow</p>
</div>

<script src="http://www.flickrshow.com/static/scripts/flickrshow-7.2.min.js"></script>
   <script>
        var cesc = new flickrshow('cesc', {
        autoplay:true,
            interval:5000,
            license:null,
            user:'54782917@N07',
            'set':'72157625444103928'
        });
   </script>


   <div class="theflickrshow" id="cesc">   
   </div>
    <script src="http://www.flickrshow.com/static/scripts/flickrshow-7.2.min.js"></script>
    <script>
        var cesc = new flickrshow('cesc', {
        autoplay:true,
            interval:5000,
            license:null,
            user:'54782917@N07',
            'set':'72157625443948800'
        });
    </script>
    <div class="flickrflash">
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="450" height="333" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="offsite=true&amp;lang=en-us&amp;pag开发者_运维知识库e_show_url=%2Fphotos%2F54782917%40N07%2Fsets%2F72157625443948800%2Fshow%2F&amp;page_show_back_url=%2Fphotos%2F54782917%40N07%2Fsets%2F72157625443948800%2F&amp;set_id=72157625443948800&amp;jump_to=" /><param name="allowFullScreen" value="true" /><param name="src" value="http://www.flickr.com/apps/slideshow/show.swf?v=71649" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="450" height="333" src="http://www.flickr.com/apps/slideshow/show.swf?v=71649" allowfullscreen="true" flashvars="offsite=true&amp;lang=en-us&amp;page_show_url=%2Fphotos%2F54782917%40N07%2Fsets%2F72157625443948800%2Fshow%2F&amp;page_show_back_url=%2Fphotos%2F54782917%40N07%2Fsets%2F72157625443948800%2F&amp;set_id=72157625443948800&amp;jump_to="></embed></object>
    </div>


You must not have the same ID more than once on the same page. Give the second <div> a differnt ID, adjust the Javascript below it accordingly and it should work.

You also don't need to include the flickrshow script more than once. It just needs to come first of all the Javascript.


<script src="http://www.flickrshow.com/static/scripts/flickrshow-7.2.min.js"></script>
<div class="theflickrshow" id="cesc">
   <p>Please enable Javascript to view this slideshow</p>
</div>


   <script>
        var cesc = new flickrshow('cesc', {
        autoplay:true,
            interval:5000,
            license:null,
            user:'54782917@N07',
            'set':'72157625444103928'
        });
   </script>


   <div class="theflickrshow" id="cesc2">   
   </div>
    <script>
        var cesc = new flickrshow('cesc2', {
        autoplay:true,
            interval:5000,
            license:null,
            user:'54782917@N07',
            'set':'72157625443948800'
        });
    </script>
    <div class="flickrflash">
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="450" height="333" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="offsite=true&amp;lang=en-us&amp;page_show_url=%2Fphotos%2F54782917%40N07%2Fsets%2F72157625443948800%2Fshow%2F&amp;page_show_back_url=%2Fphotos%2F54782917%40N07%2Fsets%2F72157625443948800%2F&amp;set_id=72157625443948800&amp;jump_to=" /><param name="allowFullScreen" value="true" /><param name="src" value="http://www.flickr.com/apps/slideshow/show.swf?v=71649" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="450" height="333" src="http://www.flickr.com/apps/slideshow/show.swf?v=71649" allowfullscreen="true" flashvars="offsite=true&amp;lang=en-us&amp;page_show_url=%2Fphotos%2F54782917%40N07%2Fsets%2F72157625443948800%2Fshow%2F&amp;page_show_back_url=%2Fphotos%2F54782917%40N07%2Fsets%2F72157625443948800%2F&amp;set_id=72157625443948800&amp;jump_to="></embed></object>
    </div>
0

精彩评论

暂无评论...
验证码 换一张
取 消