i was trying to have my site load a picture & then a text file that is a comment about the picture, currently viewed.
well i had the picture part of it done.
i was able to hard code in a way to do a text file.
so then i tried to adjust what i wrote to also update the comment/note section.
the following code does have me trying this several ways but i really only need one. i don't really care how it is done.
at this point the image one loads but after i hit next it doesn't cycle.
currently i load the picture & the text (text part not working) by an array that is contained within the html javascript.
i would rather have this array loaded by a *.js (javascript file) if that is possible. (so far i have not found how.)
the reason is so that i edit my list instead of the html code, i fear at some point i might mess up the html with the constant editing.
this is part of the line that i added to show the comments. if it is removed it does cycle the image ok.
located in:
function showImage(i)
document.getElementById('newsBox').appendChild(newsArray[n]).src= newstxt[n];
but also in:
function removeImage(i)
//Ok, let's load all the images into an Object Array:
var imageArray=new Array();
for(i=0;ifunction First()
{
removeImage(current);
current=0;
showImage(current);
}
function Previous()
{
removeImage(current);
current=current-1;
if(current==-1) current=images.length-1;
if(current==-1) current=newstxt.length-1;
showImage(current);
}
function Next()
{
removeImage(current);
current++;
if(current==images.length) current=0;
if(current==newstxt.length) current=0;
showImage(current);
}
function Last()
{
removeImage(current);
current=images.length-1;
current=newstxt.length-1;
showImage(current);
}
//For the slide show
var slideShow=false;
function Play_Stop(obj)
{
if(!slideShow){
slideShow=setInterval("Next()",SecondsBetweenImages*1000);
obj.innerHTML="Stop >"
}else{
clearInterval(slideShow);
obj.innerHTML="Play >"
slideShow=false;
}
}
function showImage(i)
{
document.getElementById('imageBox').appendChild(imageArray[i]).src=images[i];
document.getElementById('newsBox').appendChild(newsArray[n]).src= newstxt[n];
}
function removeImage(i)
{
document.getElementById('imageBox').removeChild(document.getElementById('image_'+i));
document.getElementById('newsBox').removeChild(document.getElementById('news_'+n));
}
function init()
{
document.getElementById('image_0').src=images[0];
document.getElementById('news__0').src=[0];
}
var XHR=false;
function loadHTML(url) {
if (window.XMLHttpRequest) {
XHR = new XMLHttpRequest();
}
else {
if (window.ActiveXObject) {
try {
XHR = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
document.getElementById('imageBox').innerHTML="This document is trying to access an ActiveXObject. If you trust this site, allow the action by clicking on the bar above.";
}
}
}
if (XHR) {
XHR.onreadystatechange = showContents;
XHR.open("GET", url, true);
XHR.send(null);
}
else {
document.getElementById('imageBox').innerHTML = "Error 501: Request not implemented - XMLHttpRequest() method not found in browser library.";
document.getElementById('newsBox').innerHTML = "Error 501: Request not implemented - XMLHttpRequest() method not found in browser library.";
}
}
function showContents() {
if (XHR.readyState == 4) {
if (XHR.status == 200) {
if (XHR.responseText) {
var outMsg=XHR.responseText;
}
else {
var outMsg = "Error 500: Forbidden.";
}
}
else {
var outMsg = "Error 404: File Not Found.
";
}
document.getElementById('imageBox').innerHTML = outMsg;
document.getElementById('newsBox').innerHTML = outMsg;
}
}
window.onload=init;
-->
<< First | < Back | Archive | Play > | Next > | Last >>
news:
-------------------
i think it converted my code in to html, even though i did "You can highlight code with any of the following tags: <code>"
if anyone one wants to look at the source code for how i rotate the image you can view the functioning page. it just has the news/comments parts stripped out so that it doesn't cause problems.
http://irongun.50webs.com/
i also had this question posted here. too. but i had changed some of the code already.
http://www.dynamicdrive.com/forums/showthread.php?p=207417#post207417
actually i will update that post to my must current code.