SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2006
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My regular expression only doesn't work in Internet Explorer?

    Hi-
    on another thread I post a question on how to start my timed slight changing JavaScript slideshow to start with the next picture of what ever the particular page I was on was showing. I have a site I am building with prev and next buttons which lets you see a series of pictures using these buttons or start a slideshow from any of these pages with control buttons on top of each of these pages. So a member here named "Logic Ali" was nice enough to give me a regular expression which would do this for me. I thought that was just great and it is, however I have found a bug. This regular expression gives me the index into my slideshow of the next slide only with URLs numbered with endings of 1 through 9 in Internet Explorer. However in Firefox it gives me the correct index for all your are else ending with endings of 1 through 27. It seems that you are else with endings of 2 digits is beyond the capability of this regular expression in Internet Explorer but not in Firefox. I could certainly change my numbering system to be URL endings from 01 through 27 to make those digit lengths uniform but this would only compound the problem for Internet Explorer. I will show the code below and asked if you have a solution for me or can tell me how to start solving it myself. My present JavaScript debugger's are Firefox based and I am clueless as to how to start solving this problem. So please look over the code with the regular expressionas it is used in my code below. I have commented out the offending code and explicitly coded a zero starting point to show you what is working for me now. This commented out code appears in red. The green code is my explicit index code of zero. Also below are two links one which works in Internet Explorer with an explicit zero Index for my picture changing starting point in another that only works in Firefox beyond URLs ending in one digit.

    Code:
    window.onload = function () {
    document.getElementById("textOverW2").firstChild.nodeValue="Slideshow off";
    document.getElementById("turnOnSlides").onclick=onClickToggle;
    document.getElementById("Faster").onclick=onClickFaster;
    document.getElementById("Slower").onclick=onClickSlower;
    //slideNumber=location.href.split('?')[0].match(/0*(\d+)\.\w+$/)[1]-1;      
     var slideNumber=0;      
    slideitSetup(slidesChangingAt, slideNumber );
    setTimeout("slideit()", 5000);
    }
    page link to code that works in Firefox you are else ending in 1 through 27 but in only works in Internet Explorer in URLs ending in 1 through 9

    code that works in both Internet Explorer and Firefox but always starts from picture one regardless of the URL ending you are starting from

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MarcMiller View Post
    Hi-
    on another thread I post a question on how to start my timed slight changing JavaScript slideshow to start with the next picture of what ever the particular page I was on was showing. I have a site I am building with prev and next buttons which lets you see a series of pictures using these buttons or start a slideshow from any of these pages with control buttons on top of each of these pages. So a member here named "Logic Ali" was nice enough to give me a regular expression which would do this for me. I thought that was just great and it is, however I have found a bug. This regular expression gives me the index into my slideshow of the next slide only with URLs numbered with endings of 1 through 9 in Internet Explorer. However in Firefox it gives me the correct index for all your are else ending with endings of 1 through 27. It seems that you are else with endings of 2 digits is beyond the capability of this regular expression in Internet Explorer but not in Firefox.
    Have you tried alerting the value returned by the expression?
    Your slideshow is limited to a range of 9 images, so if you try to start it on a page outside that range, the value returned by the expression, (which you pass as an index) will be out of range, after which behaviour in any browser is unpredictable.

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2006
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Logic Ali- thank you very much for your continued interest in helping me. I feel embarrassed that I had not realized I failed to update my array to 27 members with the rest of my code and there is no problem with the regular expression you have given me in Internet Explorer or Firefox, it was just my mistake.

    Very sincerely and embarrassed
    Marc


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •