Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member Dennis McPhee's Avatar
    Join Date
    Aug 2011
    Posts
    9
    Member #
    29129
    Im not sure if this is the correct location for this thread, but Ill give it a shot. I dont really have any experience with JS, just some knowledge from poking around online a little. It sounded like I might need to use JS or jQuery to make this work.

    Im making a new website for our local football team, and would like a couple of things to happen with it. First off, heres a link to the webpage Im trying to work with.

    http://www.sheltonkings.com/TestSite/schedules.html

    Under the Team Schedules menu on the left is a set of links, Flag, Minor etc... When those links are clicked, I would like an image to display in the content_main div (the main white area) The team schedules are sent to me in a JPG format. Is it possible for me to do what Im wanting to do? I would appreciate any advise you could give me. Ill upload my source files so you could view the coding easier. I have also included the folder of the actual schedule images incase you want to help me out

  2.  

  3. #2
    Junior Member Dennis McPhee's Avatar
    Join Date
    Aug 2011
    Posts
    9
    Member #
    29129
    Oops, the file didnt work. Try that again.

  4. #3
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    Try this place...

    Seems I've seen something similar to what you mentioned...

    http://www.cssplay.co.uk/menu/

    Can be done without JS... But stu has a site that has JS to.... You'll seethe link on this site

  5. #4
    Junior Member Dennis McPhee's Avatar
    Join Date
    Aug 2011
    Posts
    9
    Member #
    29129
    So I still cant get this to work right... Im using jQuery datalink to try to make this work, but somethings off... Heres my code

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    <title>SlickRed | florida web design</title>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
    $("li a").click(function() { $("#content_main").html("<img src='" + $(this).attr("data-link") + "' />"); });
    </script>
    </head>

    For the link...

    <li><a href="" data-link="http://www.sheltonkings.com/TestSite...s/flag_sch.jpg">Flag</a></li>

    Can anyone tell whats wrong? Its not showing anything when the link is pressed...

  6. #5
    Member christopher_b's Avatar
    Join Date
    Aug 2011
    Location
    Pretoria, South Africa
    Posts
    69
    Member #
    29042
    Liked
    7 times
    the problem is....
    You are targeting a <img> attribute that doesn't exist....normally that code should be.
    .attr("src","data-link")

    You should tell it what to target, this would be the "src" and then you populate the "src"

    But in actual fact, I'll need to look at the bigger picture here...the links do not work

  7. #6
    Member christopher_b's Avatar
    Join Date
    Aug 2011
    Location
    Pretoria, South Africa
    Posts
    69
    Member #
    29042
    Liked
    7 times
    oh and the reason why it is targeting the "li a" is because you are saying $(this).
    You should be more specific, like

    Code:
    $("#content_main").html("<img src='" + $("#content_main img").attr("src","data-link") + "' />");
    When you have a click function and you use "this" then the script will auto assign the "this" to the clicked element, unless you assign it again with a new function within that function.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:48 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com