03. juni 2002 - 15:02
Der er
2 kommentarer og 1 løsning
Fejl i mouseover funktion
Hej, Jeg har nedenstående mouseover funktion, som desværre fejler. Hvem kan hjælpe ? <html> <head> <title>test444</title> </head> <script> #thumpLayer { padding : 10; width : 125px; height : 125px; z-index : 98; border : 2px outset white; background-color: #ececec; } #thumpPic { border : 2px inset white; } var thumpImg = new Image(); var thumpInt; function checkImg(imgName) { if (thumpImg.readyState == "complete" || thumpImg.readyState == 4) { document.all.thumpPic.innerHTML = "<img src='/images/varer/" + imgName + "'>"; clearInterval(thumpInt); } } function hidePop() { if (document.all) { document.all.thumpLayer.style.visibility = "hidden"; document.all.thumpPic.innerHTML = "<img src='/images/clock.gif'>"; clearInterval(thumpInt); } } function showPop(imgName) { thumpImg.src = "/images/varer/" + imgName; thumpInt = window.setInterval("checkImg('" + imgName + "')",100); imgWidth = thumpImg.width; if (mouseThumpX + imgWidth + 24 + 20 >= document.body.clientWidth) { objDivStyle.left = mouseThumpX - (imgWidth + 24 + 30); } document.all.thumpLayer.style.visibility = "visible"; } function positionPop(imgName) { if (document.all) { mouseThumpX = event.clientX - event.offsetX + document.body.scrollLeft + 20; mouseThumpY = event.clientY - event.offsetY + document.body.scrollTop; objDivStyle = document.all.thumpLayer.style; objDivStyle.left = mouseThumpX; objDivStyle.top = mouseThumpY; objDivStyle.visibility = "visible"; showPop(imgName); } } function bigPicPop(bigImgName,picWidth,picHeight) { hidePop(); picWidth = picWidth + 20; picHeight = picHeight + 50; winX = (screen.availWidth - picWidth)/2; winY = (screen.availHeight - picHeight)/2 - 12; picWind = window.open("picpop.asp?ImgName="+ImgName, "blank_", "resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,screenY=" + winY + ",top=" + winY + ",screenX=" + winX + ",left=" + winX + ",width= " + picWidth + ",height= " + picHeight + ""); picWind.focus(); } </script> <body> dddd <table> <tr> <td><a href='java script:void 0;' onMouseOver="positionPop('12345.jpg');" onMouseOut="hidePop();" onMouseUp="bigPicPop('12345.jpg',125,125);"><img SRC='/images/cam.gif' border='0'></a></td> </tr> </table> </boby> </html>
Annonceindlæg fra Cognizant
Slettet bruger
03. juni 2002 - 15:02
#1
Jeg vil egentlig hellere se et link!
Heysa ! Jeg vil lige sige at der er mange fejl i overstående kode... Bl.a har du lagt dit CSS ned i din javascript kode...det er det første der går galt....dernæst refererer du til noget "layers" der overhoved ikke findes i din kode.... Hvis vi vidste hvad der skulle ske ville det væære nemmere at finde ud af hvad der skal laves eller rettes....først og fremmest skal din kode gå's igennem....(kan bl.a også se du har et slut tag der hedder "</boby>"...den virker heller ikke helt....måske "</body>")... Jeg har prøve at rydder lidt op....så kan du da teste uden at få fejl...men det ville være rart hvis vi vidste hvad scriptet skulle udføre.... venligst <ATN/> *********| Code Start |******** <html> <head> <title>test444</title> </head> <style> #thumpLayer { padding : 10; width : 125px; height : 125px; z-index : 98; border : 2px outset white; background-color : #ececec; } #thumpPic { border : 2px inset white; } </style> <script> var thumpImg = new Image(); var thumpInt; function checkImg(imgName) { if (thumpImg.readyState == "complete" || thumpImg.readyState == 4) { document.all.thumpPic.innerHTML = "<img src='/images/varer/" + imgName + "'>"; clearInterval(thumpInt); } } function hidePop() { if (document.all) { document.all.thumpLayer.style.visibility = "hidden"; // document.all.thumpPic.innerHTML = "<img src='/images/clock.gif'>"; clearInterval(thumpInt); } } function showPop(imgName) { thumpImg.src = "/images/varer/" + imgName; // thumpInt = wind9ow.setInterval("checkImg('" + imgName + "')",100); imgWidth = thumpImg.width; if (mouseThumpX + imgWidth + 24 + 20 >= document.body.clientWidth) { objDivStyle.left = mouseThumpX - (imgWidth + 24 + 30); } document.all.thumpLayer.style.visibility = "visible"; } function positionPop(imgName) { if (document.all) { mouseThumpX = event.clientX - event.offsetX + document.body.scrollLeft + 20; mouseThumpY = event.clientY - event.offsetY + document.body.scrollTop; objDivStyle = document.all.thumpLayer.style; objDivStyle.left = mouseThumpX; objDivStyle.top = mouseThumpY; objDivStyle.visibility = "visible"; showPop(imgName); } } function bigPicPop(bigImgName,picWidth,picHeight) { hidePop(); picWidth = picWidth + 20; picHeight = picHeight + 50; winX = (screen.availWidth - picWidth)/2; winY = (screen.availHeight - picHeight)/2 - 12; picWind = window.open("picpop.asp?ImgName="+ImgName, "blank_", "resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,screenY=" + winY + ",top=" + winY + ",screenX=" + winX + ",left=" + winX + ",width= " + picWidth + ",height= " + picHeight + ""); picWind.focus(); } </script> <body> <table> <tr> <td> <a href="java script:void 0;" onMouseOver="positionPop('12345.jpg');" onMouseOut="hidePop();" onMouseUp="bigPicPop('12345.jpg',125,125);"> <img SRC='/images/cam.gif' border='0'> </a> </td> </tr> </table> <div id="thumpLayer" style="visibility:hidden;position:absolute;"> Hey </div> </body> </html>
Det var lige hvad jeg skulle bruge. Mange tak.
Vi tilbyder markedets bedste kurser inden for webudvikling