I posted this as a subtopic in another message,
http://groups.google.com/group/jquery-en/browse_thread/thread/f54857cfb9e24dd9/fa98fe39cc523699#fa98fe39cc523699
but I now see that probably is a separate JS issue that the purist
here might appreciate.
Not to long ago, I came across JS behavior and just noted it down.
The issue in the reference link above reminded me of this.
This code is basically part of First, Prev, Next, Last, table
navigator for our ad hoc report/table generator. It is pre-jQuery
work. So here I am using the $() function to get the element.
function $(v) { return(document.getElementById(v)); }
function gotoPrevPage()
{
$("start").value -= 1*$("rows").value; // <- WORKS AS EXPECTED
}
function gotoNextPageBUG()
{
$("start").value += 1*$("rows").value; // <- BUG!!
}
function gotoNextPageFIX()
{
$("start").value -= -1*$("rows").value; // <- FIX!!
}
I was multiplying by 1 to help JS type cast the operation to tell it
that it adding or substracting a number rather than a string. If you
remove the multiplier, JS will naturally concatentate strings.
But that didn't work for the gotoNextPage() function using the
inclusive += operation. It worked fine with -= operation in
gotoPrevPage().
So I used the reverse logic to multiply by -1 instead with -= and it
worked.
To me, that looks look like a JS type casting bug or inclusive
addition bug?
What say you?
--
HLS
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery (English)" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-en?hl=en
-~----------~----~----~----~------~----~------~--~---