Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image Gallery not working properly. Help me.

    Dear All,

    I am currently designing a image gallery and not working properly.

    First time running and clicking "Next" button is OK. But when I press the "Next" button again, it fails. Could you help me?

    Check the following scripts.

    Thanks all.


    -----
    <html>

    <head>

    <title>test </title>

    <script language="JavaScript1.2">

    var Rows = 5;
    var Columns = 4;
    var suffix = "2003Xmas";
    var ptr = 0;
    var many = "101";
    var endx = "163";
    var picname = suffix+many+".JPG";
    var i=0;
    var j=0;

    function init() {
    // i = j = 0;
    many = "101";
    }

    function displayThumbs() {

    alert("text/html");
    //document.open("text/html");
    //document.write("<HTML><HEAD>");
    //document.write("<TITLE>View</TITLE>");
    //document.write("</HEAD><BODY>");

    document.write(many);
    document.write("<table>");
    for(j=0;j<Rows; j++) { // rows
    document.write("<tr>");
    for(i=0;i<Columns; i++) { // columns
    picname = suffix+many+".JPG";
    document.write("<td>");
    document.write('<a href=');
    document.write('"');
    document.write(picname);
    document.write('"');
    document.write(' onClick="');
    document.write("displayimage(this.href,'');");
    document.write('return false;"');
    document.write('>');
    document.write("<img src=");
    document.write('"');
    document.write(picname);
    document.write('"');
    document.write(' width="60" height="50" >');
    document.write("</a>");
    document.write(" </td>");
    document.write("\n");
    many++;
    if( many > endx ) break;
    }
    document.write("</tr>");
    document.write("<p> </p>");
    document.write("\n");
    if( many > endx ) break;
    }
    document.write("</table>");
    document.write("End of loop");
    //document.write("</BODY></HTML>");
    //document.close();
    return true;
    }

    function previousThumbs() {
    if( many < Rows*Columns ) return false;
    many -= Rows*Columns;
    displayThumbs();
    GenButton();
    return true;
    }

    function nextThumbs() {
    alert("zzznext = " + many);
    if( many > endx ) {
    alert('End of Pics');
    return false;
    }
    displayThumbs();
    GenButton();
    return true;
    }

    function displayimage(a,b) {
    var e;
    var l;
    alert('image = '+ a);
    var myimage = new Image();
    myimage.src = a;
    e = myimage.width+40;
    l = myimage.height+80;


    PreView = window.open("", "Preview", " toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=" + e + ",height=" + l);

    PreView = window.open("", "Preview", " toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=6 00,height=400");

    PreView.document.open();
    PreView.moveTo(0,0);
    PreView.document.write("<HTML><HEAD>");
    PreView.document.write("<TITLE>VIEW IMAGE</TITLE>");
    PreView.document.write("</HEAD><BODY BGCOLOR=FFFFFF TEXT=000000>");
    PreView.document.write("<FORM>");
    PreView.document.write("<IMG HSPACE=0 VSPACE=0 " + "SRC=" + a + ">");
    //PreView.document.write("<P><CENTER>"+ b +"</CENTER></P>");
    PreView.document.write("<HR><CENTER><FORM><INPUT TYPE='button' VALUE='Close' " + "onClick='window.close()'></FORM></center>");
    PreView.document.write("</BODY></HTML>");
    PreView.document.close();
    }


    function GenButton() {
    ///'<FORM NAME="buttonbar">' +
    document.write(
    '<FORM NAME="buttonbar">' +
    '<INPUT TYPE="button" VALUE="Prev" onClick="previousThumbs();return false;">' +
    '<INPUT TYPE="button" VALUE="Next" onClick="nextThumbs();return false;">' +
    '</FORM>');
    return true;
    }

    </script>
    </head>

    <body>

    <script language="JavaScript1.2">

    var q = init();
    var r = displayThumbs();

    </script>
    11dsdsdsds
    <FORM NAME="buttonbar">
    <INPUT TYPE="button" VALUE="Prev" onClick="previousThumbs();return false;">
    <INPUT TYPE="button" VALUE="Next" onClick="nextThumbs();return false;">
    </FORM>

    </body>

    </html>
    Attached Files Attached Files


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •