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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    confused and frustrated

    First let me say, I do know how to code I just haven't for a VERY long time and things are slow to come back. That being said, I'm working on a self induced project to bring back my coding abilities and I'm stuck. What I'm wanting to happen is when a certain link is clicked it goes to a certain photo album and pulls random pics just from that album and displays them in a certain place on that page. What would be the best way to approach this to make it happen?
    I'm not wanting someone to do this for me, just get me going in the right direction.

    Thanks....

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,083
    Thanks
    38
    Thanked 498 Times in 492 Posts
    Create the HTML template that the JS will act upon.
    Once you have the placement and placeholders of the template, then use JS to accomplishe the actions.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,447
    Thanks
    76
    Thanked 4,372 Times in 4,337 Posts
    I'm *guessing* that by "goes to a certain photo album" you mean that it accesses some directory on some server. And it simply looks in the directory to find what images are there.

    If that's the case, you won't do it with JavaScript and HTML, alone, as JS/HTML does *NOT* have the ability to access the server's file system. Period. So you'll need some server-side code. PHP, ASP, ASP.NET, JSP, CF, cgi, etc.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,083
    Thanks
    38
    Thanked 498 Times in 492 Posts

    Arrow

    Quote Originally Posted by Old Pedant View Post
    I'm *guessing* that by "goes to a certain photo album" you mean that it accesses some directory on some server. And it simply looks in the directory to find what images are there.

    If that's the case, you won't do it with JavaScript and HTML, alone, as JS/HTML does *NOT* have the ability to access the server's file system. Period. So you'll need some server-side code. PHP, ASP, ASP.NET, JSP, CF, cgi, etc.
    I was assuming (bad on me) that the album would be a list of files pointing to the images on the directory. But you could be right ... guess we'll have to wait for the OP response.

  • #5
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, but I guess I should clarify. I already have the web site created, not uploaded as it is not finished. The design is good and "looks pretty" but I haven't made things work like I have envisioned. Hence the js grief. What I was wondering is if I use the onclick handler does it have to be in a function or form? This is where my memory leaves me. For example can I use it like this alone:

    {function spiral(I won't put that code here because it's an embedded code
    from where I created this spiral picture display in flash)
    <input type = "button" value ="Stars and Stripes"
    onclick="spiral"/>}

    Anyway, I thought I would get this part to work before I ventured off into the random pic generator.

    Thanks again

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,447
    Thanks
    76
    Thanked 4,372 Times in 4,337 Posts
    if I use the onclick handler does it have to be in a function or form?
    No.

    Code:
    <input type="button" value="Go for it!" onclick="location.href='anotherPage.html';" />
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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