Hopefully I can explain this correctly. I have been looking everywhere for a java script that will allow Next and Previous buttons that do not run on History viewed. I found a script here on the website that works great for what we wanted. We can’t use PHP here at the plant so I turned to Java in HTML. (Boss likes MS). My problem is that the next and previous script is written for images that start like 1.jpg. It then allows the next link to pull the images up in order such as 2.jpg, 3.jpg. The problem is that our images here have to be 0001.jpg up to 10000.jpg. I am not a great web programmer with Java, but can muddle by. I am assuming the problem is coming from this line? : var newNumber = RegExp.$1*1+number; I tried playing with the Varnumber and increasing it from 001/999 to 0001/9999, but that just breaks the viewing.
Can anyone help me to identify what needs to be changed in this script so it will work with our image naming conventions?
Thanks
Sin
Here is the original script I found here from another user:
<script type=”text/javascript”>
<!–//
function changePage(number){
var firstNumber = 001;
var lastNumber = 999;
var content = document.getElementById(‘content’);
var oldNumber = content.src.match(/(d+)(?=.
var newNumber = RegExp.$1*1+number;
if(newNumber < firstNumber){ newNumber = lastNumber };
if(newNumber > lastNumber) { newNumber = firstNumber };
content.src = content.src.replace(/(d+)(?=.
document.getElementById(‘test’).innerHTML = content.src;
}
//–>
</script>
</head>
<body>
<a href=”#” class=”link” onclick=”changePage(-1)”>Back</a>
<a href=”#” class=”link” onclick=”changePage(+1)”>Forward</a>
<div><iframe id=”content” src=”0001.jpg” style=”height:800; width:800″></iframe></div>
<div id=”test”></div>