object expected fejl ved kørsel på nettet men ikke lokalt
Hej,Jeg har følgende kode, som virker ganske glimrende lokalt på min maskine...Ingen fejl overhovedet - det fungerer bare :-)
MEN.....når jeg lægger det ud på en side, får jeg følgende fejl
Object expected.
Den fejler ved følgende:
onmouseover="OnImgMouseOver(event,this);"
Jeg HAR checket der både findes en 2_gummi_thumb.jpg og 2_gummi.jpg.
Kan nogen fortælle mig, hvad jeg gør forkert?
Min kode:
<script language="javascript" type="text/javascript">
/**********************************************/
/* EventHandling */
/**********************************************/
var slideId = -1;
var isAminating = false;
var useSlide = true;
var supportedBrowser = isSupported();
function isSupported() {
if (typeof document.documentElement.style.maxHeight != "undefined") {
return true;
}
return false;
}
function slideIn() {
var layer = document.getElementById('theImg');
if (layer.height < 418) {
layer.height += 10;
}
if (layer.width < 559) {
layer.width += 100;
} // 418 X 559
if ((layer.height >= 418) && (layer.width >= 559)) {
clearInterval(slideId);
isAnimating = false;
}
}
function OnImgMouseOver(ev, caller) {
if (!supportedBrowser) {
return;
}
if (!isAminating) {
var elm = caller;
isAminating = true;
var parts = new Array();
var layer = document.getElementById('PopUpLayer');
if (layer == null) {
WriteLayers();
layer = document.getElementById('PopUpLayer');
}
parts = elm.getAttribute('src').split('/');
layer.innerHTML = '<div style="position: relative;margin:0;padding:0;left: 5px; top: 5px;background-color: black;"> <div style="background-color: silver;"> <div style="border: 1px solid black;position: relative;left: -5px;top: -5px;"><img id="theImg" height="0" width="0" src=' + elm.getAttribute('src').replace('_thumb', "") + ' ></div></div> </div>';
layer.style.top = NewfindPosY(elm) + 'px';
layer.style.left = NewfindPosX(elm) + elm.width + 10 + 'px';
layer.style.visibility = 'visible';
slideId = setInterval(slideIn, 1);
}
}
function OnImgMouseOut(ev) {
if (!supportedBrowser) {
return;
}
var layer = document.getElementById('PopUpLayer');
if (layer == null) {
return;
}
layer.style.visibility = 'hidden';
clearInterval(slideId);
isAminating = false;
}
/**********************************************/
/* positioning of popuplayer */
/**********************************************/
function NewfindPosX(obj) {
var curleft = 0;
if (obj.offsetParent) {
while (obj.offsetParent) {
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function NewfindPosY(obj) {
var curtop = 0;
if (obj.offsetParent) {
while (obj.offsetParent) {
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
function WriteLayers() {
var body = document.getElementsByTagName('body')[0];
var layer = document.createElement('div');
layer.id = 'PopUpLayer';
layer.name = 'PopUpLayer';
layer.style.visibility = 'hidden';
layer.style.position = 'absolute';
body.appendChild(layer);
}
</script>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="width: 10%"></td>
<td style="text-align: center">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
2_gummi
</td>
<td></td>
<td>
nggshow
</td>
</tr>
<tr>
<td>
<img alt="" onmouseover="OnImgMouseOver(event,this);" onmouseout="OnImgMouseOut(event,this);" src="Images/2_gummi_thumb.jpg" />
</td>
<td style="width: 10px"></td>
<td>
<img alt="" onmouseover="OnImgMouseOver(event,this);" onmouseout="OnImgMouseOut(event,this);" src="Images/nggshow_thumb.jpg" />
</td>
</tr>
</table>
</td>
<td style="width: 10%"></td>
</tr>
</table>
mvh
simsen :-)