HALP ! You're My Last Resort

admin

Administrator
Staff member
Looking all over for the correct code to make the following http:// links stay in the original (parent) frame and NOT open into a new child/blank page.

Also I can't figure out how to make the slideshow scroll automatically when the arrow controls are pressed.....


Anyone have some fairly simple code for me to implement ?
Please, please, please ?
I'm a model not a coder so I'm pretty clueless about javascripting.


T H A N K S Mandy K. :( :confused: :)

I have a javascript slideshow of my modeling pics on my main page which then references this javascript:



//Create image address array
var imgArr = new Array("images/96887jpg.jpg",
"images/55465jpg.jpg",
"images/56556jpg.jpg",
"images/56554jpg.jpg"
);//replace the images above with your own.

var urlArr = new Array("http://**.**.***.**/one.htm",
"http://**.**.***.**/two.htm",
"http://**.**.***.**/three.htm",
"http://**.**.***.**/four.htm"
);//Array that will hold the URLs to be opened when an image is clicked

var urlIndex = 0; //int value to be passed to urlArr fro required URL to be opened
var ni = 8; //number of image to be displayed starts from 0 there fore 2=3 images
// be displayed at any given time.Making change to this number will
//affect the number of images being displayed.

/**********************DO NOT MAKE ANY CHANGES BELOW*****************************/

var index = 0; //image counter at run-time

//Create image source array
var imgSrc = new Array();
for(x=0;x<imgArr.length;x++){
var img = new Image();
img.src = imgArr[x];
imgSrc[x] = img.src;
}

/*
Load images at the start of the page
*/
function loadImages(){
for(n=0;n<8;n++){
eval('document.s'+(n+1)+'.src=imgArr[n]');
index++;
}
}

/*
display next image
*/
function next(){
m=0;
for(x=ni;x>=0;x--){
eval('document.s'+(m+1)+'.src=imgArr[whichImg((m+1),1)]');
m++;
}
index++;
}

/*
show previous image
*/
function previous(){
m=0;
for(x=ni;x>=0;x--){
eval('document.s'+(m+1)+'.src=imgArr[whichImg((m+1),-1)]');
m++;
}
index++;
}
/*
@param v image source index
@param flag Direction
*/
function whichImg(v,flag){
var j=0;
for(y=0;y<imgSrc.length;y++){
var srcA = imgSrc[y].toString();
var srcB = (eval('document.s'+v+'.src')).toString();
if(srcA==srcB){
break;
}
}
if(flag==1){
y++;
j=(y==imgArr.length) ? 0 : y;
}else{
--y;
j=(y<0) ? imgArr.length-1 : y;
}
return j;
}

/*
@param obj Image source pointer
Gets the URL and opens it in a new window.
*/
function openImageURL(obj){
var url = getImageURL(obj);
var newWin = window.open(url,"newWin");
}

/*
@param obj Image source pointer
matches the selected images source's index with relative URL
and returns URL of the page to be opened.
*/
function getImageURL(obj){
var url;
for(y=0;y<imgSrc.length;y++){
var srcA = imgSrc[y].toString();
var srcB = obj.src.toString();
if(srcA==srcB){
url = urlArr[y].toString();
break;
}
}
return url;
}
 
Back
Top