Question: My application is hosted at: 127.0.0.1:8000

I invoked a jQuery method to load some content into a container (simplified for example):

```
$('body').load('127.0.0.1:8000/static/views/testing.html');

```

Upon running this line of code, I'm greeted with an error message:

> 
> XMLHttpRequest cannot load %3127.0.0.1:8000/static/views/testing.html. Cross origin requests are only supported for HTTP.
> 
> 
> 

Somewhere along the line, jQuery is mangling the URL and adding "%3". If I remove the colon, the %3 disappears. This is not a cross-origin problem, as the source and target are both at 127.0.0.1:8000.

Is there some problem that I'm not aware of, inherent to using jQuery.load() with a port specifier in the URL?

I'm running this in Chromium on Ubuntu 12.04 LTS (Version 23.0.1271.97 Ubuntu 12.04 (23.0.1271.97-0ubuntu0.12.04.1))

Answer: 
Well, the problem is this: IE understands document.getElementsByName(...)[0] as document.getElementById(...). So if you would define also an id for your element, the method document.getElementsByName(element\_name)[0].innerHTML="" will surprisingly also work in IE!

But since you anyway need to define an id due to IE, and since an id must always start with a char first, you must use:

```
<div id="a234">
    <img src="pic.gif" height="70" width="100" onMouseOver="clear('a234')">
</div> 

```

And this command:

```
function clear(element_id){
    document.getElementById(element_id).innerHTML="";
}

```

Even more, document.getElementsByName(...)[0] is slower in Firefox: <http://www.uize.com/tests/performance/getElementById-vs-getElementsByName.html>

So the id definitely wins the race.

**UPDATE:**

Also important is the fact, that we can adress every id by #a234{...} in a **CSS** file. So we can define *an own style for every id*, and this makes the id even more powerful.
Using **getElementsByName** to get a DOM Element where the **name** attribute is not part of the W3C spec (eg, in the question, name doesn't exist for DIV element), IE doesn't get those elements. FF does it. 

Just to clarify: ***expando attribute*** or better known as ***custom attribute*** is what I am talking about attributes that are not part of the W3C spec.

Read: [getElementsByName in IE7](https://stackoverflow.com/questions/278719/getelementsbyname-in-ie7)   

Read: <http://msdn.microsoft.com/en-us/library/ms536438(VS.85).aspx>

So in conclusion:  

Use **getElementsByName** when trying to get **"Form Controls"** (input, select, textarea) because they have **name** as an attribute according to the spec.

If the elements are not Form Controls, use getElementById instead.