By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,625 Members | 1,497 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,625 IT Pros & Developers. It's quick & easy.

id is not defined in Firefox

P: 3
Here is slideshow script and in Firefox alone it is not working, it is working in IE and chrome, can you see what the issue is
i am getting id not defined at "
Expand|Select|Wrap|Line Numbers
  1.     setInterval('slideShow(' + divId + ')', 3000);
"

Expand|Select|Wrap|Line Numbers
  1. $(document).ready(function() {
  2. $('.heroBanner').each(function(index) {    
  3.         var $divObject = $(this);
  4.         show($divObject);
  5.     });
  6. });
  7.  
  8. //Slides starts from from 0 index.
  9. function show(currentDiv) {
  10.     currentDiv.find("ul.carausalWrapper li").eq(0).addClass("activePro");
  11.     currentDiv.find("div.pagination ul li").eq(0).find("a").addClass("active");
  12.     var divId = currentDiv.attr('id');
  13.     //alert(divId);
  14.     setInterval('slideShow(' + divId + ')', 3000);
  15. }
  16.  
  17. //Slides the images based on the slide interval.
  18. function slideShow(currentDivId) {
  19.     //alert(currentDivId);
  20.     var $divObject = $(currentDivId);
  21.     var $active = $divObject.find("ul.carausalWrapper li.activePro");
  22.     var $pageActive = $divObject.find("div.pagination ul li a.active");
  23.     var $inx = $divObject.find("ul.carausalWrapper li.activePro").index();
  24.     var $elemLength = parseInt($divObject.find("ul.carausalWrapper li").length) - 1;
  25.     var $next = 0;
  26.     $active.removeClass('activePro');
  27.     $pageActive.removeClass('active');
  28.     if ($inx < $elemLength) {
  29.         $next = parseInt($inx) + 1;
  30.     }
  31.     if ($inx == $elemLength) {
  32.         $next = 0;
  33.     }
  34.     $divObject.find("ul.carausalWrapper li").eq($next).addClass("activePro");
  35.     $divObject.find("div.pagination ul li").eq($next).find("a").addClass("active");
  36. }
  37.  
Any help is greatly appreciated.
Nov 18 '11 #1
Share this Question
Share on Google+
6 Replies


acoder
Expert Mod 15k+
P: 16,027
On line 13 where you've commented out the alert, did you get the expected value?

Also, what's the exact error message?

Could you give some sample ".heroBanner" divs?
Nov 18 '11 #2

100+
P: 1,059
even if .heroBanner then you will have to use jQuery like below:
Expand|Select|Wrap|Line Numbers
  1. $('#.heroBanner')........
  2.  
Nov 18 '11 #3

P: 3
I just kept alerts for testing, and here is some sample html
Expand|Select|Wrap|Line Numbers
  1. <div style="width:100%" class="heroBanner slideBody" id="dnn_ctr642_MultiView_ctl00_divSimpleSlideShow">
  2.     <ul class="carausalWrapper">
  3.  
  4.                  <li style="width:100%" class="activePro">
  5.                     <div>
  6.                         <span class="carausalWrapper-span heroBannerImage" style="width: 270px;">
  7.                             <img alt="" src="/cmsfiles/media/images/banner_hero_img.jpg" class="carausalWrapper-img" style="width: 250px; height: 150px;">
  8.                         </span><span>
  9.                             <p>
  10.                                 <a href="http://localhost/dotnetnuke/awin/ArticlesStory.aspx?id=/article-xml/avd_10_12_2010_p04-02-260873.xml">
  11.                                     <b>
  12.                                         Virgin Blue Faces $20M Hit From Computer Outage</b></a></p>
  13.                             <p>
  14.                                 Virgin Blue (VB) estimates an 11-day disruption caused by a computer s...
  15.                                 <a href="http://localhost/dotnetnuke/awin/ArticlesStory.aspx?id=/article-xml/avd_10_12_2010_p04-02-260873.xml">
  16.                                     + See full article</a>
  17.                             </p>
  18.                         </span>
  19.                     </div>
  20.                 </li>
  21.  
  22.                  <li style="width:100%">
  23.                     <div>
  24.                         <span class="carausalWrapper-span heroBannerImage" style="width: 270px;">
  25.                             <img alt="" src="/cmsfiles/media/images/Banner_img.gif" class="carausalWrapper-img" style="width: 250px; height: 150px;">
  26.                         </span><span>
  27.                             <p>
  28.                                 <a href="http://localhost/dotnetnuke/awin/ArticlesStory.aspx?id=/article-xml/AW_08_15_2011_p20-357727.xml">
  29.                                     <b>
  30.                                         Technology Push</b></a></p>
  31.                             <p>
  32.                                 U.S. space-technology researchers soon will be able to start work on s...
  33.                                 <a href="http://localhost/dotnetnuke/awin/ArticlesStory.aspx?id=/article-xml/AW_08_15_2011_p20-357727.xml">
  34.                                     + See full article</a>
  35.                             </p>
  36.                         </span>
  37.                     </div>
  38.                 </li>                              
  39.     </ul>
  40.     <div align="center" class="nav pagination">
  41.         <table align="center" style="height:100%;">
  42.             <tbody><tr>
  43.                 <td valign="middle">
  44.                     <ul class="images-button">
  45.  
  46.                                 <li class="images-button-li"><a href="javascript:void(0);" class="active">
  47.                                     1
  48.                                 </a></li>
  49.  
  50.                                 <li class="images-button-li"><a href="javascript:void(0);">
  51.                                     2
  52.                                 </a></li>
  53. </ul>
  54.                 </td>
  55.             </tr>
  56.         </tbody></table>
  57.     </div>
  58. </div>
  59.  
Nov 18 '11 #4

P: 3
johny,

$('#.heroBanner')........ didn't worked
Nov 18 '11 #5

acoder
Expert Mod 15k+
P: 16,027
I know you used the alerts for testing. I was asking if they give the expected ID value?

You didn't answer my question on the exact error message you see in Firefox?
Nov 21 '11 #6

acoder
Expert Mod 15k+
P: 16,027
even if .heroBanner then you will have to use jQuery like below:
Expand|Select|Wrap|Line Numbers
  1. $('#.heroBanner')........
  2.  
That's not going to work. # is for ID and . is for selecting classes.

See http://api.jquery.com/category/selec...css-selectors/
Nov 21 '11 #7

Post your reply

Sign in to post your reply or Sign up for a free account.