one of the cooler open source projects i've seen.
http://ffmpeg.org/index.html
5/20/11
5/11/11
Getting rid of the trailing comma that blows up javascript in internet explorer (IE)
if you are like me, you can't stand writing pages for IE. Finicky and unique (from chrome and ff). One of my frustrations in writing code for IE that also incorporates jquery (or any javascripti function) is that IE chokes on trailing "," while FF does not.
For instance this exerpt describes the creation of a "formless submit" using jquery form plugin:
Normally I would write out "}," on the last line - however by putting in the comma write out at the top of the loop (along with a simple conditional statement to keep the first one from appearing) I can avoid the dreaded trailing comma.
-bp
For instance this exerpt describes the creation of a "formless submit" using jquery form plugin:
This code would blow up in IE because of the last "," The solution I've found is to write out the comma at the top of the do loops instead of the logical end. For instance:
$(document).ready(function() {
$('#inputform1').ajaxForm({
// target identifies the element(s) to update with the server response
target: '#htmlExampleTarget1',
// success identifies the function to invoke when the server response
// has been received; here we apply a fade-in effect to the new content
success: function() {
$('#formsubmit1').html("entry saved");
$('#htmlExampleTarget1').fadeIn('slow');
}
});
$('#inputform2').ajaxForm({
// target identifies the element(s) to update with the server response
target: '#htmlExampleTarget2',
// success identifies the function to invoke when the server response
// has been received; here we apply a fade-in effect to the new content
success: function() {
$('#formsubmit2').html("entry saved");
$('#htmlExampleTarget2').fadeIn('slow');
},
});
});
record=0
DO WHILE NOT objResultsSet.EOF
record = record + 1
if record>1 then
response.write(",")
END IF
-------------remainder of the loop
response.write(vbLf & "}")
objResultsSet.MoveNext
LOOP
Normally I would write out "}," on the last line - however by putting in the comma write out at the top of the loop (along with a simple conditional statement to keep the first one from appearing) I can avoid the dreaded trailing comma.
-bp
Subscribe to:
Posts (Atom)