Unknown Runtime Error in Internet Explorer while using innerHTML
This is one of those awesome “features” of the Microsoft browser. One which can send web developers of the deep end.
Seems this error may happen due to several reasons:
- You are trying to put a block-level element inside an inline element like a div element inside a p element (see source 1)
- You are trying to set a table’s innerHTML (see source 2)
- You are trying to put a form element inside an element that is itself inside another form
In my case i chose to replace the original form completely or avoid using the form tag in these situations. All together this seems like a design problem as situations like this should not occur in the first place.
Note that if you run into trouble with the prototype Ajax functions you might want to set the onException option in order to see what is really happening. Though in this case the exceptions isn’t particularly helpful since it only states : Unknown Runtime Error
Update:
If this happens to you when using prototype ajaxupdater, create your own ajaxreplacer that replaces the div instead of trying to set innerHtml.
Sources:
FireFox keeps asking for Proxy Authentication
I use firefox at work to do my browsing of the interwebz, for some stupid reason i recently ran into a problem where firefox kept asking me for the proxy authentication instead of saving the previous entered information. It would do this for every resource on a page. So when i opened a webpage i would have to click the damn ok button multiple times.
I smal search on google produce the following link : http://forums.mozillazine.org/viewtopic.php?p=3070251
If you don’t want to go reading the forums here is the TLDR solution – change network.negotiate-auth.allow-proxies property in about:config to false
This works for newer versions of firefox too.
Clear a form with javascript (prototypejs)
The following snippet clears all fields in a form:
function apagarForm(formName) { $(formName).getElements().each(function(item) { if (item.name != "form_name" && item.type != "button" && item.type != "submit") { if (item.tagName == "SELECT") { item.selectedIndex = 0; } else if (item.type == "text") { Form.Element.clear($(item.id)); } else if (item.type == "radio" || item.type == "checkbox") { item.checked = false; } } }) }
This uses prototype to iterate over the form fields.