Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1899 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

loop problem with if inside

Thread title: loop problem with if inside
Closed Thread    
    Thread tools Search this thread Display Modes  
11-14-2007, 04:56 PM
#1
Nightscream is offline Nightscream
Status: Junior Member
Join date: Aug 2006
Location:
Expertise:
Software:
 
Posts: 58
iTrader: 0 / 0%
 

Nightscream is on a distinguished road

  Old

but the images are with 01 so when it's below 10 it need just a number because in the name the 0 is already defined and when it's bigger you have to remove the 0 so -2
if you know what i mean

[edit]
Fixed it
HTML Code:
<!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=iso-8859-1" />
<title>Untitled Document</title>

<script type="text/javascript">
var W3CDOM = (document.createElement && document.getElementsByTagName);

var image = Array();

window.onload = main;

function main() {
	if (!W3CDOM) return;
	
	var img = document.getElementById('images');
	var imgs= img.getElementsByTagName('img');
	
	for(var i = 0; i < imgs.length; i++) {
		
		var bigImage
		
		if (i < 9) {		
			bigImage = imgs.item(i).src.substring(0, imgs.item(i).src.indexOf("_")-1);
		}
		if(i >= 9) {
			bigImage = imgs.item(i).src.substring(0, imgs.item(i).src.indexOf("_")-2);
		}
					
		bigImage += (1+i) +".jpg";

			
		image[i] = new Image
		image[i] = bigImage;
		
		
	}
}

function show_image(num) {
	document.getElementById("FullSize").src = image[num];
}
</script>

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed