Firefox is the odd one out
-
I was writing some Javascript to clear a file uploader, and the following code will clear it on IE 7, Safari 3.1.2, and Opera 9.51:
document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.outerHTML = document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.outerHTML;
On Firefox 3.0.1, that code does not work. However, the following code works on Firefox only and none of the other browsers:
document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.value = '';
Do any of you find Firefox to be the odd one out very often?
-
I was writing some Javascript to clear a file uploader, and the following code will clear it on IE 7, Safari 3.1.2, and Opera 9.51:
document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.outerHTML = document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.outerHTML;
On Firefox 3.0.1, that code does not work. However, the following code works on Firefox only and none of the other browsers:
document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.value = '';
Do any of you find Firefox to be the odd one out very often?
-
I was writing some Javascript to clear a file uploader, and the following code will clear it on IE 7, Safari 3.1.2, and Opera 9.51:
document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.outerHTML = document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.outerHTML;
On Firefox 3.0.1, that code does not work. However, the following code works on Firefox only and none of the other browsers:
document.forms[0].ctl00_ContentPlaceHolder1_fuTestFile1.value = '';
Do any of you find Firefox to be the odd one out very often?
Jeslan wrote:
Do any of you find Firefox to be the odd one out very often?
No. I develop in FF initially, so code that uses outerHTML never works. ;) Given that your first technique is essentially just a quick way of re-writing the <input> element, you should be able to accomplish the same thing explicitly using the DOM:
function dofilereset(fileInputId)
{
var f = document.getElementById(fileInputId);
var attrsToCopy = ['type', 'id', 'class', 'style', 'name', 'size', 'title',
'align', 'accept', 'tabindex', 'accesskey'];
var newF = document.createElement("input");
for (var i=0; i<attrsToCopy.length; ++i)
newF.setAttribute(attrsToCopy[i], f.getAttribute(attrsToCopy[i]));
f.parentNode.replaceChild(newF, f);
}Citizen 20.1.01
'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'