PDA

View Full Version : Can you see any problem?



Moh
13-12-2008, 01:22 PM
Well the error is in... Internet Explorer - How surprising!

Well this works perfectly fine in Firefox, but Internet Explorer is having none of it.

The error in IE is:

document.getElementById(...) is null or not an object

My radio player code is:

<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" name="player" width="167" height="40" standby="Loading" codebase="http://www.habbcrazy.net/CODEBASE=http:/activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715">
<param name="player" id="radio_player" url="http://www.habbcrazy.net" value="true" />
<param name="CONTROLS" value="Imagewindow" />
<param name="ShowStatusBar" value="false" />
<param name="src" id="radio_src" value="http://habbcrazy.net:8002/" />
<param name="url" id="radio_url" value="http://habbcrazy.net:8002/" />
<param name="autostart" value="true" />
<param name="autoplay" value="true" />
<param name="Controls" value="playbutton" />
<param name="uimode" value="mini" />
<embed id="radio_embed" src="http://www.habbcrazy.net/pages/radio/mediafile.asx" showstatusbar="false" controls="playbutton" autostart="True" width="167" height="40" autostart="True" controls="playbutton" showstatusbar="false" url="http://www.habbcrazy.net/pages/radio/mediafile.asx" showstatusbar="false" controls="playbutton" autostart="True" autoplay="true" uimode="mini" />
</object>

My Javascript code is:


function refresh_radioplayer()
{
document.getElementById('radio_src').value = "http://habbcrazy.net:8002/";
document.getElementById('radio_url').value = "http://habbcrazy.net:8002/";

document.getElementById('radio_embed').src = "http://www.habbcrazy.net/pages/radio/mediafile.asx";
document.getElementById('radio_embed').url = "http://www.habbcrazy.net/pages/radio/mediafile.asx";
}

As you can see, all the ids exist :S

iUnknown
13-12-2008, 01:45 PM
Get code from http://tech-hosts.co.uk/player and change the source. That works in firefox and internet explorer (asx source required for it to work in firefox).

Calon
13-12-2008, 01:50 PM
Get code from http://tech-hosts.co.uk/player and change the source. That works in firefox and internet explorer (asx source required for it to work in firefox).
He's making a javascript refresh function, not using another player.

Alternatively, I think you could do something with the browser, because I can't spot anything wrong with the code. Something to detect what browser and just do a normal refresh if IE? or just do that completely, lol?

Robbie
13-12-2008, 01:53 PM
IE uses the <object> bit and FF uses the <embed> bit and only <embed> has the ID radio_embed

Moh
13-12-2008, 01:54 PM
I found out the reason. Internet Explorer likes to do its own thing and ignore ids on objects.

I had to add an id to the object tag (player), and use the following javascript code:



function refresh_radioplayer()
{
if(navigator.appName == "Microsoft Internet Explorer") {

document.getElementById('player').src = "http://habbcrazy.net:8002/";
document.getElementById('player').url = "http://habbcrazy.net:8002/";

} else {

document.getElementById('radio_src').value = "http://habbcrazy.net:8002/";
document.getElementById('radio_url').value = "http://habbcrazy.net:8002/";
document.getElementById('radio_embed').src = "http://www.habbcrazy.net/pages/radio/mediafile.asx";
document.getElementById('radio_embed').url = "http://www.habbcrazy.net/pages/radio/mediafile.asx";

}
}

Want to hide these adverts? Register an account for free!