...

View Full Version : Can i combine these two scripts?



hvadseth79
12-28-2003, 02:16 PM
The first script i a picture gallery:(sorry about the norwegian words in there)

This is the table with the first picture:

<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="00304A"><b><img src="Bjorliweekend/mariannemedfleir_s.jpg" width="273" height="204" name="photoslider">

Here is the script!

<script language="JavaScript1.1">

/*
Photo Slider II- By Kevin Adams (kadams70@hotmail.com)
For this script and more
Visit http://www.javascriptkit.com
*/

var photos=new Array()
var text=new Array()
var which=0
var what=0

//Change the below variables to reference your own images. You may have as many images in the slider as you wish
photos[0]="Bjorliweekend/mariannemedfleir_s.jpg"
photos[1]="Bjorliweekend/damm_s.jpg"
photos[2]="Bjorliweekend/erling_s.jpg"
photos[3]="Bjorliweekend/flammer_s.jpg"
photos[4]="Bjorliweekend/kort_s.jpg"
photos[5]="Bjorliweekend/leik_s.jpg"
photos[6]="Bjorliweekend/nattverd_s.jpg"
photos[7]="Bjorliweekend/rødhette2_s.jpg"
photos[8]="Bjorliweekend/rødhette_s.jpg"
photos[9]="Bjorliweekend/rødtertøft_s.jpg"
photos[10]="Bjorliweekend/sofaspeidern_s.jpg"
photos[11]="Bjorliweekend/solveigoggutter_s.jpg"
photos[12]="Bjorliweekend/sverreholst_s.jpg"
photos[13]="Bjorliweekend/varmestua_s.jpg"
photos[14]="Bjorliweekend/vidar_s.jpg"

//change coresponding description
text[0]="Marianne liker seg med guttene"
text[1]="Skiføre var visst veldig bra...?"
text[2]="Hvem er damen til Erling?"
text[3]="Koselig med peis!"
text[4]="Her har vi det gøy..eller?"
text[5]="...så leiker vi oss litt!"
text[6]="Ingen Bjorlitur uten nattverd..."
text[7]="Harald med jorbærlue!"
text[8]="Rødhette og ulven"
text[9]="Rødt er visst in i år!"
text[10]="Sofaspeider'n slår til igjen!"
text[11]="Solveig med noen guttevenner..."
text[12]="Sverre og Holst i samstemt latter!"
text[13]="Varmestua er god å ha!"
text[14]="Militærgutten!"

window.onload=new Function("document.rotater.description.value=text[0]")

function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which];
what--
document.rotater.description.value=text[what];
}
}

function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
what++
document.rotater.description.value=text[what];
}
else window.status='Det var alt desverre!'
}

function type()
{
alert("This textbox will only display default comments")
}


</script>


Here comes a script that opens a picture in a new windows that the scripts generate:

<script language="JavaScript1.2">
<!--
function openWin( winHeight, winWidth, picSrc ){
newWin = window.open('', '', 'height='+ winHeight + ',width='+ winWidth + 'toolbars=no, width=330,height=300, scrollbars=no' );
newWin.document.write("<head><title>"+ picSrc +"</title></head>");
newWin.document.write("<p align=center>");
newWin.document.write("<img src=" + picSrc + ">"); newWin.document.write("<br><br><form><input type='button' value='Close' onclick='JavaScript:window.close()'>");
newWin.document.write("</form></p>");
}
-->
</script>

Here is one of the link's

<img src="1_l.jpg" width="75" height="56" onClick="openWin(300,300,'1.JPG')" border="1">



I want to combine the script's a open one of the pictures in the gallery script in a new windows! see?

Please help!

Mr J
12-28-2003, 06:41 PM
Please try the following




<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<script language="JavaScript">
<!--
/*
Photo Slider II- By Kevin Adams (kadams70@hotmail.com)
For this script and more
Visit http://www.javascriptkit.com
*/

var photos=new Array()
var text=new Array()
var which=0
var what=0

//Change the below variables to reference your own images. You may have as many images in the slider as you wish
photos[0]="Bjorliweekend/mariannemedfleir_s.jpg"
photos[1]="Bjorliweekend/damm_s.jpg"
photos[2]="Bjorliweekend/erling_s.jpg"
photos[3]="Bjorliweekend/flammer_s.jpg"
photos[4]="Bjorliweekend/kort_s.jpg"
photos[5]="Bjorliweekend/leik_s.jpg"
photos[6]="Bjorliweekend/nattverd_s.jpg"
photos[7]="Bjorliweekend/rødhette2_s.jpg"
photos[8]="Bjorliweekend/rødhette_s.jpg"
photos[9]="Bjorliweekend/rødtertøft_s.jpg"
photos[10]="Bjorliweekend/sofaspeidern_s.jpg"
photos[11]="Bjorliweekend/solveigoggutter_s.jpg"
photos[12]="Bjorliweekend/sverreholst_s.jpg"
photos[13]="Bjorliweekend/varmestua_s.jpg"
photos[14]="Bjorliweekend/vidar_s.jpg"

//change coresponding description
text[0]="Marianne liker seg med guttene"
text[1]="Skiføre var visst veldig bra...?"
text[2]="Hvem er damen til Erling?"
text[3]="Koselig med peis!"
text[4]="Her har vi det gøy..eller?"
text[5]="...så leiker vi oss litt!"
text[6]="Ingen Bjorlitur uten nattverd..."
text[7]="Harald med jorbærlue!"
text[8]="Rødhette og ulven"
text[9]="Rødt er visst in i år!"
text[10]="Sofaspeider'n slår til igjen!"
text[11]="Solveig med noen guttevenner..."
text[12]="Sverre og Holst i samstemt latter!"
text[13]="Varmestua er god å ha!"
text[14]="Militærgutten!"

window.onload=new Function("document.rotater.description.value=text[0]")

function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which];
document.rotater.description.value=text[which];
}
}

function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
document.rotater.description.value=text[which];
}
else window.status='Det var alt desverre!'
}

function type(){
alert("This textbox will only display default comments")
}

function openWin( winHeight, winWidth){
picSrc=document.images.photoslider.src
newWin = window.open('', '', 'height='+ winHeight + ',width='+ winWidth + 'toolbars=no, width=330,height=300, scrollbars=no' );
newWin.document.write("<head><title>"+ picSrc +"</title></head>");
newWin.document.write("<p align=center>");
newWin.document.write("<img src=" + picSrc + ">"); newWin.document.write("<br><br><form><input type='button' value='Close' onclick='window.close()'>");
newWin.document.write("</form></p>");
}

// -->
</script>

<img name="photoslider" src="1_l.jpg" width="75" height="56" onClick="openWin(300,300)" border="1">

<form name="rotater">
<input type="text" name="description" size="50">
<input type="button" value="back" onclick="backward()">
<input type="button" value="next" onclick="forward()">
</form>

</BODY>
</HTML>

hvadseth79
12-29-2003, 05:28 PM
Thanks it worked. Since you probebly are good at this, can you help me with this one? It's the same script's but in the opposite direction.

I like to have a page with many thumbnails. And when i press on of them the script generate a new page with a bigger copy of the picture, and the input box with the text under the picture. I like of course different text to all the pictures. Do you see what I mean? Thank's

Mr J
12-29-2003, 10:09 PM
Take a look at the following address

www.huntingground.freeserve.co.uk/scripts/snav.htm

There are 6 image gallery scripts here

Image Gallery 1
Image Gallery 2
Image Gallery 3
Image Gallery 3 v2
Image Gallery 3 v3
Image Gallery 3 css

See if one of these will be ok for you.

If not I can adapt your script above

hvadseth79
12-31-2003, 02:28 AM
I looked trought the script's and there was many goog scripts, but all of them had a little detail that I don't want to use. So if you have the time it had been wonderful if you can look at the scripts i had and make them the way I descibed. Thank you!!

hvadseth79
12-31-2003, 02:31 AM
SCript number one of thoose you showed me was fine, exept from the thing that generate the Gallery 1 text left to the tabel. The only thing I want is the tabel that I can edit myself, and the script that open the thunbnails in a new window with additional text under it. Thank you!!!

Mr J
12-31-2003, 01:51 PM
Please try the following


<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<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("Bjorliweekend/mariannemedfleir_s.jpg","Marianne liker seg med guttene")
photos[1]=new Array("Bjorliweekend/damm_s.jpg","Skiføre var visst veldig bra...?")
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=320 // window width
win_height=300 // 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=no, 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("<br><br><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="thumbnail1.jpg" onclick="bigpic(0)"></td>
<td><img src="thumbnail2.jpg" onclick="bigpic(1)"></td>
<td><img src="thumbnail3.jpg" onclick="bigpic(2)"></td>
<td><img src="thumbnail4.jpg" onclick="bigpic(3)"></td>
<td><img src="thumbnail5.jpg" onclick="bigpic(4)"></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>

</BODY>
</HTML>

hvadseth79
01-06-2004, 04:35 PM
Sorry, but the script didn't worked. I think it has something with the onclick calling the scriptm but I tried everything that I know, but I didn't worked. So do you have any ideas?

Mr J
01-07-2004, 12:03 AM
It appears that the script in my previous post gets screwed up a bit when copied from this forum.

I have put the script in an HTML file and zipped it.

Download this zip and try the file again.

Don't forget, you need to put your thumbnail in the table and its larger image in the array

hvadseth79
01-07-2004, 10:54 PM
Thanks, but I have One last question!

Is it possible to make the popup windows to resize to the picture and text under it?, now all popup have to be the same size...please?

hvadseth79
01-07-2004, 11:45 PM
Thanks, but I have One last question!

Is it possible to make the popup windows to resize to the picture and text under it?, now all popup have to be the same size...please?

hvadseth79
01-07-2004, 11:58 PM
I also like to have the text as verdana font family, and #666666 color and size "2" ...can you do that?

Mr J
01-08-2004, 11:14 AM
Can you give me some idea as to how much text is going to be shown under the picture?

hvadseth79
01-08-2004, 12:30 PM
This is an example:

"Her er styret og frivillige i full gang med å støvesuge og rydde til julebordet, men hva er det Rebekka driver med?" with size 2 or 1.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum