...

View Full Version : How to make the script resize the popup?



hvadseth79
01-10-2004, 01:51 PM
I have this script that make a popup when I press a picture i a table. It also put additional text under it. But now I have to diside the same size for every popup's. I want the script to resize the popup to the every picture no matter size. And I want of course the text also under it.

Here's the script:

<script language="JavaScript">
<!--
// each array index contains the larger image and the description

// photos[n]=new Array("larger image.jpg","your text")

var photos=new Array()
photos[0]=new Array("Julebord03/1.jpg","Her er styret og frivillige i full gang med å støvesuge og rydde til julebordet, men hva er det Rebekka driver med?")
photos[1]=new Array("Julebord03/1.jpg","Her er styret og frivillige i full gang med å støvesuge og rydde til julebordet, men hva er det Rebekka driver med?")
photos[2]=new Array("Bjorliweekend/erling_s.jpg","Hvem er damen til Erling?")
photos[3]=new Array("Bjorliweekend/flammer_s.jpg","Koselig med peis!")
photos[4]=new Array("Bjorliweekend/kort_s.jpg","Her har vi det gøy..eller?")
photos[5]=new Array("Bjorliweekend/leik_s.jpg","...så leiker vi oss litt!")
photos[6]=new Array("Bjorliweekend/nattverd_s.jpg","Ingen Bjorlitur uten nattverd...")
photos[7]=new Array("Bjorliweekend/rødhette2_s.jpg","Harald med jorbærlue!")
photos[8]=new Array("Bjorliweekend/rødhette_s.jpg","Rødhette og ulven")
photos[9]=new Array("Bjorliweekend/rødtertøft_s.jpg","Rødt er visst in i år!")
photos[10]=new Array("Bjorliweekend/sofaspeidern_s.jpg","Sofaspeider'n slår til igjen!")
photos[11]=new Array("Bjorliweekend/solveigoggutter_s.jpg","Solveig med noen guttevenner...")
photos[12]=new Array("Bjorliweekend/sverreholst_s.jpg","Sverre og Holst i samstemt latter!")
photos[13]=new Array("Bjorliweekend/varmestua_s.jpg","Varmestua er god å ha!")
photos[14]=new Array("Bjorliweekend/vidar_s.jpg","Militærgutten!")


function bigpic(num){
win_width=500 // window width
win_height=500 // window height

win_left = (screen.availWidth - win_width) / 2
win_top = (screen.availHeight - win_height) / 2


newWin = window.open('', '', 'left='+win_left+',top='+win_top+',width='+win_width+',height='+win_height+', scrollbars=yes, toolbars=no' );
newWin.document.write("<head><title> </title></head><body>");
newWin.document.write("<center>");
newWin.document.write("<img src=" + photos[num][0] + ">");
newWin.document.write("<div id=\"display_text\"></div>");
newWin.document.write("<div style=\"width:100%;text-align:center;font-family:verdana\"></div>");
newWin.document.write("<a href=\"#null\" onclick='window.close()'>Close Me</a>");
newWin.document.write("</center>");
newWin.document.write("</body></html>");
newWin.document.getElementById("display_text").innerHTML=photos[num][1]
}

// -->
</script>


<table border="1">
<tr>
<td><img src="Julebord03/_thumb1.JPG" onClick="bigpic(1)" width="100" height="75"></td>
<td><img src="Julebord03/_thumb2.JPG" onclick="bigpic(1)" width="100" height="75"></td>
<td><img src="Julebord03/_thumb3.JPG" onclick="bigpic(2)" width="100" height="75"></td>
<td><img src="Julebord03/_thumb4.JPG" onclick="bigpic(3)" width="100" height="75"></td>
<td><img src="Julebord03/_thumb5.JPG" onclick="bigpic(4)" width="100" height="75"></td>
</tr>
<tr>
<td><img src="thumbnail6.jpg" onclick="bigpic(5)"></td>
<td><img src="thumbnail7.jpg" onclick="bigpic(6)"></td>
<td><img src="thumbnail8.jpg" onclick="bigpic(7)"></td>
<td><img src="thumbnail9.jpg" onclick="bigpic(8)"></td>
<td><img src="thumbnail10.jpg" onclick="bigpic(9)"></td>
</tr>
<tr>
<td><img src="thumbnail11.jpg" onclick="bigpic(10)"></td>
<td><img src="thumbnail12.jpg" onclick="bigpic(11)"></td>
<td><img src="thumbnail13.jpg" onclick="bigpic(12)"></td>
<td><img src="thumbnail14.jpg" onclick="bigpic(13)"></td>
<td><img src="thumbnail15.jpg" onclick="bigpic(14)"></td>
</tr>
</table>

hvadseth79
01-12-2004, 12:41 AM
Please!!

glenngv
01-12-2004, 08:39 AM
http://www.codingforums.com/showthread.php?s=&threadid=9836



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum