4 Replies - 567 Views - Last Post: 25 June 2013 - 09:17 AM

#1 back_room  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-June 13

html/css/javascript - gallery buttons

Posted 25 June 2013 - 01:56 AM

hello,

i was wondering if anyone could help. i have got a snippet of code which i have used. all i get is a very nice outlined square, with a broken image link. the buttons which are to be used, just a previous and next, do not appear either.

any help that you could offer, would be gratefully received.

code below


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title></title>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>

<style type="text/css">
		
body {
	background-color:#ffffff
}
#pictures {
	width:200px;
	height:200px;
}
#dvtwo {
	width:200px;
	height:200px;
	background:#ffffff;
	position:absolute;
	top:50%;
	left:50%;
	margin-top:-100px;
	margin-left:-100px;
	border:solid 1px #000000;
}
#one {
	text-align:center;
}

#previous {
	background:url(../../../buttons/previous.png)
}

#next {
	background:url(../../../buttons/next.png)
}
</style>

<script type="text/javascript">

var image= new Array();
image[0]='/img/file 1T.jpg';
image[1]='/img/file 2 T.jpg';
image[2]='/img/file 3 T.jpg';
image[3]='/img/file 4T.jpg';
image[4]='/img/file 5T.jpg';
image[5]='/img/file 6T.jpg';
image[6]='/img/file 7T.jpg';
image[7]='/img/file 8T.jpg';
image[8]='/img/file 9T.jpg';
image[9]='/img/file 10T.jpg';
image[10]='/img/file 11T.jpg';
image[11]='/img/file 12T.jpg';
image[12]='/img/file 13T.jpg';
var i=0;

function first (){
	if ((i!==0)||(i==0)){
		i=0;
		document.getElementById("pictures").src = image[i]
	}
}

function previous(){
	if (i>=1){
		i=i-1;
		document.getElementById("pictures").src = image[i]
	}
}

function next(){
	if ((i<=0)&&(i<=image.length-2)){
		i=i+1;
		document.getElementById("pictures").src = image[i]
	}
}

function last(){
	if (i!=image.length){
		i=image.length-1
		document.getElementById("pictures").src = image[i]
	}
}
onload=first;

</script>
		
<style media="screen" type="text/css">
html, body {
	height:100%;
}
body {
	margin:0;
	padding:0;
	height:100%;
	background-color:#ffffff;
}
#container {
	min-height:100%;
	position:relative;
}
#header {
	background-color:#ffffff;
	padding:10px;
}
#main {
	min-height:100%;
	padding:10px;
	padding-bottom:100px;
}

*html #main {
	height:100%;
}
#footer {
	position:absolute;
	bottom:0;
	width:100%;
	height:100px;
	
}
</style>
<bodyonload="MM_preloadImages('../../../....
    
    <div id="dvtwo"><img id="pictures" src="/img/" alt"pictures" /></div>
    <div id="one">
    <button id="previous" onclick="previous()">&lt;&lt;</button>
    <button id="next" onclick="next()">&lt;&lt;</button>
    </div>
    </p>
    <div class="footer" id="footer">
    ........
</body>
</html>



the file system is pretty much self explanatory html file with pictures in img folder. no other files in there.

any help would be gratefully received.

thanks

Is This A Good Question/Topic? 0
  • +

Replies To: html/css/javascript - gallery buttons

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,251
  • Joined: 08-June 10

Re: html/css/javascript - gallery buttons

Posted 25 June 2013 - 02:07 AM

Quote

all i get is a very nice outlined square, with a broken image link

that means that the images are not where the browser expects them to be (itís as simple as that).


besides that, line #149 is totally messed up. line #151 does not reference an image at all. I doubt the URLs of the background images are correct either. line #84, the condition is always true (any value is always 0 or not 0). line #138 misses a space (which can lead the whole section to be skipped).

and about the dreamweaver code I do not dare speaking.
Was This Post Helpful? 0
  • +
  • -

#3 back_room  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-June 13

Re: html/css/javascript - gallery buttons

Posted 25 June 2013 - 03:45 AM

thanks for the response,

within the array for the pictures, would i be able to use:

image[0]="url:src.../.../file1T.jpg"

would that alleviate the problem of not being able to find the files?

please excuse me, very new to all of this.

This post has been edited by Dormilich: 25 June 2013 - 03:47 AM

Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,251
  • Joined: 08-June 10

Re: html/css/javascript - gallery buttons

Posted 25 June 2013 - 03:50 AM

View Postback_room, on 25 June 2013 - 12:45 PM, said:

within the array for the pictures, would i be able to use:

image[0]="url:src.../.../file1T.jpg"

no. thatís not the correct format.


View Postback_room, on 25 June 2013 - 12:45 PM, said:

would that alleviate the problem of not being able to find the files?

no. you need to know the correct URL of the image. from that you can make the appropriate relative path.
Was This Post Helpful? 0
  • +
  • -

#5 back_room  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-June 13

Re: html/css/javascript - gallery buttons

Posted 25 June 2013 - 09:17 AM

Ok..... I think that with your help I should be fine. I was just asking if it would work in that format. I was giving it as an example, so I think I should be fine. Thanks for the guidance. As I said earlier, very new to all of this. Maybe will also explain the dreamweaver mess!!

Thanks again

This post has been edited by Dormilich: 25 June 2013 - 10:17 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1