webForumDet fria alternativet

Scriptproblem

3 svar · 261 visningar · startad av elf88

elf88Medlem sedan aug. 20047 inlägg
#1

Tjena, har aldrig använt Java förr, men om man nu får en kod som den som e nedanför. Vart ska man sätta in den i t.ex. start.htm?

Script
<script type="text/javascript">
/* The code contained in this file is copyrighted by https://www.jojoxx.net
The file may be used for none commercial applications and distributed
as long as these lines remain intact. The file or part of it may not
be sold or included in any other commercial application without
agreement from the author. If you have questions or comments, contact
the author at http://www.jojoxx.net

© Copyright - https://www.jojoxx.net - 2004 */

function imgPopup4(url){
MyWin = window.open("","","scrollbars=no,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=100,height=100");
with(MyWin.document){
open();
write("<html>\n<head><scr"+"ipt>");
write("window.onresize=function(){if(document.getElementById){\ndocument.getElementById('myimg').style.width=(document.all)?document.body.clientWidth:window.innerWidth;\ndocument.getElementById('myimg').style.height=(document.all)?document.body.clientHeight:window.innerHeight;\n}}\n");
write("awidth=(document.layers)?0:8;awidth+=(document.all)?4:0;aheight=(document.layers)?0:29;\n");
write("window.onload=function(){ window.resizeTo(document.images[0].width+awidth,document.images[0].height+aheight); window.moveTo(parseInt(screen.width/2-document.images[0].width/2),parseInt(screen.height/2-document.images[0].height/2));\n");
write("if(document.all) document.all['wait'].style.visibility='hidden';\n");
write("if(document.layers) document.layers['wait'].visibility='hide';\n");
write("if(document.getElementById) document.getElementById('wait').style.visibility='hidden';\n");
write("}\n</scr"+"ipt>\n");
write("<title>Bildvisare</title>\n</head>\n<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 rightmargin=0 style=\"overflow:hidden;\">\n");
write("<div id='wait' style='position:absolute;top:0px;left:0px;width:100px;height:100px;background-color:rgb(0,0,200);color:white;font:bold 12px Arial;'><p> </p><p>Vänta...<br>Bilden laddas</p></div>\n");
write("<img id='myimg' src=\""+url+"\">\n");
write("</body>\n</html>\n");
close();
}
}
</script>
<a href="../../images/www.jojoxx.net.onscreen.gif" onClick="imgPopup4(this.href); return false;">Visa bild</a>

JojoxxMedlem sedan juni 20004 308 inlägg
#2

Detta JavaScript kan du lägga i princip var som hellst på sidan. Prova och lägg upp det på en sida så ser du. Skulle det inte fungera kan du skriva igen och lämna en länk till sidan.

elf88Medlem sedan aug. 20047 inlägg
#3

Japp, d funkade.
Men om ja nu vill ha bilden som länk, asså om man trycker på en liten bild öppnas ett stort fönster med bilden i? Hur gör ja d ? Just nu står det ju Klicka här typ

JojoxxMedlem sedan juni 20004 308 inlägg
#4

Byt ut "Visa bild" mot bilden i fråga. (<img src="bilden.gif" border="0">)

124 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
120 ms — hämta tråd, inlägg och bilagor (db)