Javascript sort() function not working correctly

I have an image gallery that automatically loads via a PHP readdir function which populates an array, and then I have a Javascript sort() function which sorts the images in order numerically. In Chrome and Safari, the images display as numbered in the directory. However, in Firefox and Internet Explorer, they display out of order (firefox) and not at all (ie). Here is the code for the php file: <?
Header("content-type: application/x-javascript");
function returnimages($dirname=".") {
$pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
$file = basename($file,".jpg");
echo 'myImg['.$curimage.']="'.$file .'";';
$curimage++;
closedir($handle);
return($files);
echo 'var myImg=new Array();';
returnimages()
?>
and here is the code for the javascript sort:
function sortNumber(a,b)
return a - b;
myImg.sort(sortNumber);
// Tell browser the type of file
myImgEnd = ".jpg";
var i = 0;
// Create function to load image
function loadImg(){
document.imgSrc.src = myImg[i] + myImgEnd;
Any ideas as to why Firefox is behaving this way?

After you check the box to sort on the column, are you making sure to select a sort order for the same column?
Earl

Similar Messages

  • Brush function not working correctly PS Elements 11 for Mac

    The brush is not working correctly in that I cannot drag the brush.  It allows only spot healing, not dragging the brush.  Didn't use to have this problem.  Now do.  Not sure what has changed.  Thank you!

    Is this happening after upgrading to Yosemite?
    If yes, please see:
    Photoshop Elements doesn't respond when you use editing tools in Mac OS X 10.10
    Thanks,
    Anwesha

  • Javascript Date() function not working

    Hi,
    I'm experiencing some problems with the Date() function in javascript. The problem is that the function doesn't seem to work. For example when I do "var date = new Date(); xfa.host.messageBox(date);" in the enter event of a date field, I get "Date is not a function" error message in de javascript debugger.
    Is there anyone out there who knows how why the Date function is not working in LiveCycle Designer. Am I using the Date function in an improper way or maybe I am using the wrong function?
    Please can anyone help me out?

    Hi Paul,
    Thanx for you reply. It worked fine.
    I also found out that following works as well:
    var MyDate = util.scand("dd-mm-yyyy",new Date());
    console.println("this date: "+util.printd("dd-mm-yyyy", MyDate));

  • Specified Sort Order not working correctly in InfoView

    Hello All,
    We are running Crystal 2008 version 12.2.0.290 with Infoview 12.1.0 and are having a problem with specified sort orders working correctly.  In Crystal we are using the 'Chart Expert' to set the specified order of the percent bar chart.  It works just fine in Crystal 2008 and shows the stacked bar in the order we would expect.  We then save the report to InfoView and run the report on a schedule and it comes back in a completely different order. Not the order we specified in designing the report.  Any ideas on what is going on?
    Thanks in advance.

    We are experiencing a similar issue with the sort order in Infoview. We are using Crystal XI.5.8.26 and Infoview.
    The specified sort order works correctly in Crystal but in Infoview it comes back with a different order. Are there any suggestions on resolving this disparity?
    Thank you.

  • Sort function not working

    I have a SQL report with different fields. At the report attribute when I checked sort, it gives me error "ORA-00911: invalid character". Any idea?
    My report is working fine without selecting sort function.
    Thanks,
    Mushtak

    After you check the box to sort on the column, are you making sure to select a sort order for the same column?
    Earl

  • XQuery translate() function not working correctly?

    The following XQuery fragment
    return
    xf:translate($product/@description, "&#174", "®")
    where
    $product/@description
    contains
    Complete Choice&#174 Plan
    returns
    Colete Choice® Pln
    not, as expected
    Complete Choice® Plan

    967660 wrote:
    Hi,
    Another quick question if people don't mind. Bit confused about the trunc date function. I'm following the sql fundamentals exam guide and using their examples:
    select trunc(to_date('02-jun-2009 13:00','dd-mon-yyyy hh24:mi')) day from dual;
    this returns the 2nd of june, as it should, because, as far as i'm aware, leaving the optional variable out defaults the precision to 'day'. but when i explicitly add the variable 'day', as the guide has done with 'week' 'month' and 'year' in the following examples (so i assume this format is correct rather than dd/mon/yyyy), something goes wrong:
    select trunc(to_date('02-jun-2009 13:00','dd-mon-yyyy' hh24:mi'), 'day') day from dual;
    this returns the 31st of may. which is incorrect.
    however replacing 'day' with 'dd' provides the correct answer of the 2nd again.
    this isn't a major issue, it just bothers me that the guide seems (again) to be mistaken, something that is rapidly becoming a trend in their examples. i'd also quite like to know why this is happening, as it will help improve my understanding of sql in general - perhaps there is some sort of default to allow the correct use of the variable 'day' i'm overlooking and that the guide hasn't made clear.
    btw, i'm working in sqlplus - although developer has some odd results too.
    thanks alot,
    nick'day' doesn't trunc to the beginning of the day. It truncates to the first day of the week: in your case 31st May.
    'ddd' truncates to the beginning of the day.
    So, leaving the second parameter out defaults to 'ddd' not 'day'.

  • Trunc date function not working correctly

    Hi,
    Another quick question if people don't mind. Bit confused about the trunc date function. I'm following the sql fundamentals exam guide and using their examples:
    select trunc(to_date('02-jun-2009 13:00','dd-mon-yyyy hh24:mi')) day from dual;
    this returns the 2nd of june, as it should, because, as far as i'm aware, leaving the optional variable out defaults the precision to 'day'. but when i explicitly add the variable 'day', as the guide has done with 'week' 'month' and 'year' in the following examples (so i assume this format is correct rather than dd/mon/yyyy), something goes wrong:
    select trunc(to_date('02-jun-2009 13:00','dd-mon-yyyy' hh24:mi'), 'day') day from dual;
    this returns the 31st of may. which is incorrect.
    however replacing 'day' with 'dd' provides the correct answer of the 2nd again.
    this isn't a major issue, it just bothers me that the guide seems (again) to be mistaken, something that is rapidly becoming a trend in their examples. i'd also quite like to know why this is happening, as it will help improve my understanding of sql in general - perhaps there is some sort of default to allow the correct use of the variable 'day' i'm overlooking and that the guide hasn't made clear.
    btw, i'm working in sqlplus - although developer has some odd results too.
    thanks alot,
    nick

    967660 wrote:
    Hi,
    Another quick question if people don't mind. Bit confused about the trunc date function. I'm following the sql fundamentals exam guide and using their examples:
    select trunc(to_date('02-jun-2009 13:00','dd-mon-yyyy hh24:mi')) day from dual;
    this returns the 2nd of june, as it should, because, as far as i'm aware, leaving the optional variable out defaults the precision to 'day'. but when i explicitly add the variable 'day', as the guide has done with 'week' 'month' and 'year' in the following examples (so i assume this format is correct rather than dd/mon/yyyy), something goes wrong:
    select trunc(to_date('02-jun-2009 13:00','dd-mon-yyyy' hh24:mi'), 'day') day from dual;
    this returns the 31st of may. which is incorrect.
    however replacing 'day' with 'dd' provides the correct answer of the 2nd again.
    this isn't a major issue, it just bothers me that the guide seems (again) to be mistaken, something that is rapidly becoming a trend in their examples. i'd also quite like to know why this is happening, as it will help improve my understanding of sql in general - perhaps there is some sort of default to allow the correct use of the variable 'day' i'm overlooking and that the guide hasn't made clear.
    btw, i'm working in sqlplus - although developer has some odd results too.
    thanks alot,
    nick'day' doesn't trunc to the beginning of the day. It truncates to the first day of the week: in your case 31st May.
    'ddd' truncates to the beginning of the day.
    So, leaving the second parameter out defaults to 'ddd' not 'day'.

  • Wireless Function Not Working Correctly

    When I try to print wirelessly, it prints 2-3 pages and then quits printing, often right in the middle of a page, and tells me there was a printing error. When I print through a cable, it works perfectly. The printer is about 13 feet away from the internet router and not plugged into the router.  It is plugged via USB into a desktop computer running Windows 7 32-bit.

    Hi @Musicrafter , and welcome to the HP Forums!
    I see you're experiencing connectivity issues.  I would like to try and help!
    I would recommend performing a power reset.   Disconnect the power cord from the printer and the power outlet, then wait 60 seconds. After 60 seconds, plug the printer back in. Ensure you plug the printer directly to a wall outlet. Make sure to bypass any sort of surge protector or power bar.
    I'd also suggest this document on Wireless printing center Troubleshooting Issues.
    Good luck and please let me know the results of your troubleshooting steps. Thank you for posting on the HP Forums!
    Please click “Accept as Solution " if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks" for helping!
    Jamieson
    I work on behalf of HP
    "Remember, I'm pulling for you, we're all in this together!" - Red Green.

  • Mod function not working correctly

    I wrote a code to decimal to binary number system, this code works properly for 5 but show wrong result on 47. I tried lots of times but not getting solution.When "23.5 mod 2" calculated I
    got the remainder 0 which is worng it should be 1.
    Private Function convertor_bin_and_octal(num1 As Double, system As Byte) As String
    Dim Exponent As Double, mantes As Double, num As Double, h As Byte
    Dim b As String
    Dim a As String
    If IsNumeric(num1) = True Then
    num = Int(num1)
    Exponent = num1
    While num >= system
    Refresh
    h = num Mod system
    a = a & Str(h)
    num = num / system
    Wend
    a = a & Int(num)
    a = StrReverse(a)
    num = num1
    ma = Exponent - Int(num)
    If ma <> 0 Then
    While ma <> 0
    ma = ma * system
    b = b + Str(Int(ma))
    ma = ma - Int(ma)
    Wend
    a = a & "." & b
    End If
    convertor_bin_and_octal = a
    Else
    Label2.Caption = "Please enter the numeric value only"
    Text1 = ""
    Text1.SetFocus
    End If

    Please move your post to VB forum here:
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=vbgeneral
    Fouad Roumieh

  • Playlist function not working correctly

    I have an Ipod nano 4th generation, it works fine in every way it is supposed to except when it come to the playlist function. When ever a song is selected from a list of songs or an artist/album list containing 10+ or so songs it does not add the selected son go to the on the go playlist on the ipod. Instead it adds a completely random song from the list with no logic to the song it picks. Does anyone else have this problem or know how to solve it? I have sent one Ipod away to be fixed but the replacement appears to have the same problem. Is this an issue with all 4th generation nanos or am I just rather unfortunate? if it is a recurring issue have apple acknowledged it/done anything about it?

    Because you have uploaded the files with the iWeb FTP, the folder of files created by iWeb - southcoasttv - has been uploaded along with the index.html file. Therefore the URL has the folder name in it and this is normal.
    You can change it if you want but you need to use an FTP application to upload the files rather than the whole folder....
    http://www.iwebformusicians.com/WebMusic/URLs-Favicons.html

  • DW logout function not working correctly

    I have CS4 on Vista ultimate.  I am using WAMP for testing.
    In DW, I clicked on the menus to make a logout page.  To test it I logged in as a user in one window(FF) and opened another one and logged in as a different user... When I hit the logout button on one, it logged out both users....
    How can this be that everyone gets logged out by one?  I have used dw's login and logout functionality and have not changed either...
    any ideas?

    You say that session objects are shared between all browser window/tab instances.... Those are 2 different things... tabs are in windows...Open a new window and it should be unrelated to the others....
    isnt each session id for each window unique?
    I have 2 different FF windows open, each logged in as a different user, log out one, the other is logged out as well....
    But, since your post I tested with IE and FF and then it works how its supposed to, only one is logged out...
    I understand how sessions work but thought that each window had it own unique session id, especially for different users.... I guess thats only true on two DIFFERENT browser windows... weird....
    seems like it should not be that way, but it is... so oh well, I guess thats not a real problem, just seemed like one.  Thanks.

  • About:config Javascript Enable/Disable not working correctly

    It used to be that the About:Config Javascript Enable/Disable toggle was an all or nothing swtich. If you turned it off, it was turned off for all of Firefox, including and most importantly active loaded pages with interactive content. It was an absolute need for defense against rouge pages that would do things like trap the close page function and open up many more pages when you closed a page. Other pages would attempt to download code repeatedly and the only way to truly "escape" those pages was to open up a tab with About:Config and toggle the Javascript Enabled option. This is still there, but the behavior has changed in Version 29. It no longer turns off Javascript for all pages loaded or future loaded, only future loaded ones have it turned off. This is a show stopper. Get it back to disabling for all loaded pages or we won't use Firefox anymore.

    The problem of being trapped in an onbeforeclose event handler was tackled directly. You should not encounter that problem any more as of a few versions ago. (And/or you could use my Escape bookmarklet: [http://dev.jeffersonscher.com/bookmarklets.html#escape])
    I'm not familiar with the other issue of sites trying to download code repeatedly.
    To give feature suggestions, you can use this site: https://input.mozilla.org/feedback
    To file a more detailed request for enhancement you can use Bugzilla: https://bugzilla.mozilla.org/

  • A PDF function not working correctly in Pro and Reader

    Here is more information from the field staff who informed me of the issue:
    As far as adding pictures to Live Cycle form.
    When field personnel entering the inspection data into the form, if it opens in Reader, they cannot add a photo by clicking on the “paperclip” in the lower left of the form.   The “Add” button is not there.  The can add an image in the field in the form, but I cannot get it out of the form to put into the database…you cannot manipulate the image at all once it is in the field area of the form.  No right click to copy, cut or delete.
    In Adobe Acrobat Pro 9, you can click on the paperclip, add an image file, BUT cannot right click on file to copy elsewhere..which is what I would want to see us be able to do.  I have to save the file as something else, then put it in my database…I don’t want to have to save it as something else due to our numbering system that we are using to file these…A HUGE HEADACHE..
    IF I try to add an image directly to the field in the form, once it is there, you cannot right click to delete it (copy it, cut it)..you cannot get rid of it…only “replace” it with another image….not exactly user friendly if you attach a photo by mistake…
    those are the issues I have with the live cycle form.  we are working on trying to get the information dumped directly into a database, if there are instructions on doing that I would like to have those.  It would save me a lot of time and effort.

    Is this a LabVIEW or a signal express question?
    (You post in the LabVIEW forum but only mention signal express. There is a dedicated signalexpress forum. If this is a LabVIEW question, please explain in more detail.)
    LabVIEW Champion . Do more with less code and in less time .

  • Search function not working correctly

    I have a problem searching in a specific document. For some reason, the search function only seems to sift through certain fonts, or types of text. The main text is not included in the search, but rather only (for example) the Table of Contents and some "examples" (in a special font) in the text. Everything else is omitted.
    When I copy/paste the main text, it's pasted as a strange code in this fashion, despite the fact that it's quite readable in it's original form:
    äíÉí=áåíÉ=Ü~ê=Ñí
    This is probably the reason why Search can't find terms in the main text, as searchable text looks quite right when copy/pasted. But how can I solve the problem?
    Thanks!
    David

    Did you check under the file Properties to see if the fonts are embedded? If they are not, you can reembed the fonts if you have Acrobat Pro using the Preflight tools.

  • ATP FUNCTIONALITY NOT WORKING CORRECTLY FOR ATO Model

    Guru's,
    Currently I am facing issue in ATP Inquiry to arrive at schedule ship date, we have set up an ATO Model and its low-level parts for multi level ATP, including ATP rules, item attributes, bom attributes, and lead times and ATP check is based on planned output and enabled 24X7 plan.
    When try to perform ATP inquiry either from ASCP/OM responsibility, Instead of showing complete drill down of material constraint at the part level, it "stops" at the model level and shows no availability until the inifinte supply timefence, then unlimited availability after that.
    I was earlier able to view the complete ATP pegging details with ATP dates well within ITF, but however when we re run the plan to include additional SO the above behavior is observed.
    Can some one help me to reslove the issue, as I am not sure what exactly which is triggering this behavior.
    Thanks,

    Thanks for the reply, but this note was not addressing the above stated issue. In this note for matched configuration, they are not able to view pegging else they are able to perform multilevel atp check.
    Can anyone help me to reslove this issue.
    Thanks
    Edited by: user604737 on Jun 18, 2011 4:48 AM
    Edited by: user604737 on Jun 19, 2011 11:50 PM

Maybe you are looking for