www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23

Thread: OnClick not loading image

  1. #16
    Join Date
    Mar 2012
    Posts
    16
    Oops, I'm an idiot. I was testing on the wrong test site. Stand by.

  2. #17
    Join Date
    Mar 2012
    Posts
    16
    Okay...I've tried testing the correct file, and we're still having the same issue.

    BTW I'm in the middle of a huge storm here, so if I disappear that means I've lost power for awhile.

  3. #18
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    792
    Ok, I'm a little confused to what you're seeing, as I have added more data to mine and the images all show up fine no matter what sequence I click the buttons.
    I am wondering now what involvement jQuery has in your project as I do not have all the assets you are loading?

    I am also really interested in seeing $datas now. If you write print_r($datas); before the foreach ($datas as $name) statement, it should output the contents of the variable to the browser. Please could you post that output?
    JavaScript: Learn | Validate | Compact | bionoid

  4. #19
    Join Date
    Mar 2012
    Posts
    16
    Yup, the power just came back on. I knew that would happen. Here's the output you requested:

    Code:
    Array ( [0] => Array ( [id] => 1 [state] => PA [name] => Breezewood Proving Grounds [description] => [site] => http://www.breezewoodprovinggrounds.com [street] => 4626 Robinsonville Road [city] => Clearville [zip] => 15535 ) [1] => Array ( [id] => 2 [state] => PA [name] => Four Seasons Resort [description] => Camping resort in Southwestern PA, 800 acres with 26 miles of groomed trails for all skill levels. Ride from the campsite or room. This is a family campground with planned activities and special ATV events for the whole family [site] => http://www.campfourseasonsresort.com [street] => 3 Camp Resort Road [city] => West Finley [zip] => 15377 ) [2] => Array ( [id] => 3 [state] => PA [name] => Hilltop Lodge [description] => Motocross, Quad, and Dirt Bike Farm. You rent the lodge, farm, and all of the trails [site] => http://www.hilltoplodge.com [street] => 977 Moore Hill Road [city] => Emporium [zip] => 15834 ) [3] => Array ( [id] => 4 [state] => PA [name] => Majestic Trails [description] => ATV trail system located on 940 acres of privately owned property. 2 loops totaling over 41 miles of 1 way traffic on mountainous terrain. [site] => http://www.majestictrails.com [street] => 2503 Route 46 [city] => Smethport [zip] => 16749 ) [4] => Array ( [id] => 5 [state] => PA [name] => Lost Trails [description] => New Location, variety of terrain changing trails, steep switchbacks, scenic ridges, potato fields, boulder crawls, mud runs, tunnel [site] => http://www.ridelosttrails.com [street] => 1000 Dunham Drive [city] => Dunmore [zip] => 18512 ) [5] => Array ( [id] => 6 [state] => PA [name] => Mines and Meadows ATV Park [description] => 70 miles of marked, groomed trails through forest with hill climbs, rock crawling, mud bogs. Underground limestone mine that you ride through [site] => http://www.minesandmeadows.com [street] => 1307 Old Route 18 [city] => Wampum [zip] => 16157 ) [6] => Array ( [id] => 7 [state] => PA [name] => Reading Anthracite [description] => Riding at reading anthracite coal facility with an access permit that can be obtained for a fee online [site] => http://www.readinganthracite.com [street] => 200 Mahantongo Street [city] => Pottsville [zip] => 17901 ) [7] => Array ( [id] => 8 [state] => PA [name] => Rock Run Recreation [description] => 70 miles of trails for ATVs, UTVs, and dirtbikes. [site] => http://www.rockrunrecreation.com [street] => 1228 St. Lawrence Road [city] => Patton [zip] => 16668 ) [8] => Array ( [id] => 9 [state] => PA [name] => Scrubgrass Village [description] => Multiuse facility: atv, utv, dirtbike, 4x4, tubing, fishing and kayaking [site] => http://www.sgohvpark.com [street] => 1130 Ridge Road [city] => Templeton [zip] => 16259 ) [9] => Array ( [id] => 10 [state] => PA [name] => Slippery Rock Dunes Outdoor Park [description] => Mud pits, woods trails, hill climbs, sand pit. [site] => http://www.slipperyrocdunes.com [street] => 144 Barron Road [city] => Slippery Rock [zip] => 16057 ) [10] => Array ( [id] => 11 [state] => PA [name] => Rausch Creek Trail Riders [description] => Open only to members. Miles of trails, multiple difficulty levels. [site] => http://www.tctri.org [street] => 183 Bear Valley Road [city] => Valley View [zip] => 17983 ) [11] => Array ( [id] => 12 [state] => PA [name] => Martin Hill [description] => 18 Miles of summer trail [site] => http://www.dcnr.state.pa.us [street] => 440 Buchanan Trail [city] => McConnellsburg [zip] => 17233 ) [12] => Array ( [id] => 13 [state] => PA [name] => Sideling Hill [description] => 43 miles of summer trail. A loop trail located south of Denton Hill State Park [site] => http://www.dcnr.state.pa.us [street] => Susquehannock State Forest [city] => Coudersport [zip] => 16915 ) [13] => Array ( [id] => 14 [state] => PA [name] => Potter County [description] => 43 miles of summer trail. A loop trail located south of Denton Hill State Park [site] => http://www.dcnr.state.pa.us [street] => Susquehannock State Forest [city] => Coudersport [zip] => 16915 ) [14] => Array ( [id] => 15 [state] => PA [name] => Maple Run Tract [description] => 8 miles of summer trail [site] => http://www.dcnr.state.pa.us [street] => Delaware State Forest [city] => Swiftwater [zip] => 18370 ) [15] => Array ( [id] => 16 [state] => PA [name] => Burnt Mills [description] => 7 miles of summer and winter trail [site] => http://www.dcnr.state.pa.us [street] => Delaware State Forest [city] => Swiftwater [zip] => 18370 ) [16] => Array ( [id] => 17 [state] => PA [name] => Adams & Cumberland Counties [description] => 36 miles of summer trail. During the winter season the trail system is expanded to 42 miles by using some dirt roads that are gated during the winter [site] => http://www.dcnr.state.pa.us [street] => Michaux State Forest, 10099 Lincoln Way East [city] => Feyetteville [zip] => 17222 ) [17] => Array ( [id] => 18 [state] => PA [name] => Snyder & Union Counties [description] => 7 miles of summer and winter trails [site] => http://www.dcnr.state.pa.us [street] => Bald Eagle State Forest, 18865 Old Turnpike road [city] => Millmont [zip] => 17845 ) [18] => Array ( [id] => 19 [state] => PA [name] => Clinton County [description] => [site] => http://www.dcnr.state.pa.us [street] => Sproul State Forest, 15187 Renovo Road [city] => Renovo [zip] => 17764 ) [19] => Array ( [id] => 20 [state] => PA [name] => Bloody Skillet [description] => 37 trail miles and is accessed from 18 1/2 miles north of Snow Shoe [site] => http://www.dcnr.state.pa.us [street] => Sproul State Forest, 15187 Renovo Road [city] => Renovo [zip] => 17764 ) [20] => Array ( [id] => 21 [state] => PA [name] => Lycoming County [description] => 17 miles of summer and winter trail [site] => http://www.dcnr.state.pa.us [street] => Tridaghton State Forest, 10 Lower Pine Bottom Road [city] => Waterville [zip] => 17776 ) [21] => Array ( [id] => 22 [state] => PA [name] => Dixon R. Miller [description] => 13 miles of summer and winter trails. [site] => www.dcnr.state.pa.us [street] => Delaware State Forest [city] => Swiftwater [zip] => 18370 ) [22] => Array ( [id] => 24 [state] => PA [name] => Four Seasons Resort [description] => Camping resort in Southwestern PA, 800 acres with 26 miles of groomed trails for all skill levels. Ride from the campsite or room. This is a family campground with planned activities and special ATV events for the whole family [site] => www.campfourseasonsresort.com [street] => 3 Camp Resort Road [city] => West Finley [zip] => 15377 ) [23] => Array ( [id] => 25 [state] => PA [name] => Hilltop Lodge [description] => Motocross, Quad, and Dirt Bike Farm. You rent the lodge, farm, and all of the trails [site] => www.hilltoplodge.com [street] => 977 Moore Hill Road [city] => Emporium [zip] => 15834 ) [24] => Array ( [id] => 26 [state] => NJ [name] => Test [description] => This is a test [site] => Blah blah blah [street] => Street street [city] => happyville [zip] => 10002 ) [25] => Array ( [id] => 27 [state] => WA [name] => A second test [description] => This is in Washington [site] => Let's see what happens [street] => cleanthe screen [city] => citycity [zip] => 11111 ) )

  5. #20
    Join Date
    Mar 2012
    Posts
    16
    That formatted weirdly when I put code tags around it. Let's try this to see if it is more readable.

    Array ( [0] => Array ( [id] => 1 [state] => PA [name] => Breezewood Proving Grounds [description] => [site] => http://www.breezewoodprovinggrounds.com [street] => 4626 Robinsonville Road [city] => Clearville [zip] => 15535 ) [1] => Array ( [id] => 2 [state] => PA [name] => Four Seasons Resort [description] => Camping resort in Southwestern PA, 800 acres with 26 miles of groomed trails for all skill levels. Ride from the campsite or room. This is a family campground with planned activities and special ATV events for the whole family [site] => http://www.campfourseasonsresort.com [street] => 3 Camp Resort Road [city] => West Finley [zip] => 15377 ) [2] => Array ( [id] => 3 [state] => PA [name] => Hilltop Lodge [description] => Motocross, Quad, and Dirt Bike Farm. You rent the lodge, farm, and all of the trails [site] => http://www.hilltoplodge.com [street] => 977 Moore Hill Road [city] => Emporium [zip] => 15834 ) [3] => Array ( [id] => 4 [state] => PA [name] => Majestic Trails [description] => ATV trail system located on 940 acres of privately owned property. 2 loops totaling over 41 miles of 1 way traffic on mountainous terrain. [site] => http://www.majestictrails.com [street] => 2503 Route 46 [city] => Smethport [zip] => 16749 ) [4] => Array ( [id] => 5 [state] => PA [name] => Lost Trails [description] => New Location, variety of terrain changing trails, steep switchbacks, scenic ridges, potato fields, boulder crawls, mud runs, tunnel [site] => http://www.ridelosttrails.com [street] => 1000 Dunham Drive [city] => Dunmore [zip] => 18512 ) [5] => Array ( [id] => 6 [state] => PA [name] => Mines and Meadows ATV Park [description] => 70 miles of marked, groomed trails through forest with hill climbs, rock crawling, mud bogs. Underground limestone mine that you ride through [site] => http://www.minesandmeadows.com [street] => 1307 Old Route 18 [city] => Wampum [zip] => 16157 ) [6] => Array ( [id] => 7 [state] => PA [name] => Reading Anthracite [description] => Riding at reading anthracite coal facility with an access permit that can be obtained for a fee online [site] => http://www.readinganthracite.com [street] => 200 Mahantongo Street [city] => Pottsville [zip] => 17901 ) [7] => Array ( [id] => 8 [state] => PA [name] => Rock Run Recreation [description] => 70 miles of trails for ATVs, UTVs, and dirtbikes. [site] => http://www.rockrunrecreation.com [street] => 1228 St. Lawrence Road [city] => Patton [zip] => 16668 ) [8] => Array ( [id] => 9 [state] => PA [name] => Scrubgrass Village [description] => Multiuse facility: atv, utv, dirtbike, 4x4, tubing, fishing and kayaking [site] => http://www.sgohvpark.com [street] => 1130 Ridge Road [city] => Templeton [zip] => 16259 ) [9] => Array ( [id] => 10 [state] => PA [name] => Slippery Rock Dunes Outdoor Park [description] => Mud pits, woods trails, hill climbs, sand pit. [site] => http://www.slipperyrocdunes.com [street] => 144 Barron Road [city] => Slippery Rock [zip] => 16057 ) [10] => Array ( [id] => 11 [state] => PA [name] => Rausch Creek Trail Riders [description] => Open only to members. Miles of trails, multiple difficulty levels. [site] => http://www.tctri.org [street] => 183 Bear Valley Road [city] => Valley View [zip] => 17983 ) [11] => Array ( [id] => 12 [state] => PA [name] => Martin Hill [description] => 18 Miles of summer trail [site] => http://www.dcnr.state.pa.us [street] => 440 Buchanan Trail [city] => McConnellsburg [zip] => 17233 ) [12] => Array ( [id] => 13 [state] => PA [name] => Sideling Hill [description] => 43 miles of summer trail. A loop trail located south of Denton Hill State Park [site] => http://www.dcnr.state.pa.us [street] => Susquehannock State Forest [city] => Coudersport [zip] => 16915 ) [13] => Array ( [id] => 14 [state] => PA [name] => Potter County [description] => 43 miles of summer trail. A loop trail located south of Denton Hill State Park [site] => http://www.dcnr.state.pa.us [street] => Susquehannock State Forest [city] => Coudersport [zip] => 16915 ) [14] => Array ( [id] => 15 [state] => PA [name] => Maple Run Tract [description] => 8 miles of summer trail [site] => http://www.dcnr.state.pa.us [street] => Delaware State Forest [city] => Swiftwater [zip] => 18370 ) [15] => Array ( [id] => 16 [state] => PA [name] => Burnt Mills [description] => 7 miles of summer and winter trail [site] => http://www.dcnr.state.pa.us [street] => Delaware State Forest [city] => Swiftwater [zip] => 18370 ) [16] => Array ( [id] => 17 [state] => PA [name] => Adams & Cumberland Counties [description] => 36 miles of summer trail. During the winter season the trail system is expanded to 42 miles by using some dirt roads that are gated during the winter [site] => http://www.dcnr.state.pa.us [street] => Michaux State Forest, 10099 Lincoln Way East [city] => Feyetteville [zip] => 17222 ) [17] => Array ( [id] => 18 [state] => PA [name] => Snyder & Union Counties [description] => 7 miles of summer and winter trails [site] => http://www.dcnr.state.pa.us [street] => Bald Eagle State Forest, 18865 Old Turnpike road [city] => Millmont [zip] => 17845 ) [18] => Array ( [id] => 19 [state] => PA [name] => Clinton County [description] => [site] => http://www.dcnr.state.pa.us [street] => Sproul State Forest, 15187 Renovo Road [city] => Renovo [zip] => 17764 ) [19] => Array ( [id] => 20 [state] => PA [name] => Bloody Skillet [description] => 37 trail miles and is accessed from 18 1/2 miles north of Snow Shoe [site] => http://www.dcnr.state.pa.us [street] => Sproul State Forest, 15187 Renovo Road [city] => Renovo [zip] => 17764 ) [20] => Array ( [id] => 21 [state] => PA [name] => Lycoming County [description] => 17 miles of summer and winter trail [site] => http://www.dcnr.state.pa.us [street] => Tridaghton State Forest, 10 Lower Pine Bottom Road [city] => Waterville [zip] => 17776 ) [21] => Array ( [id] => 22 [state] => PA [name] => Dixon R. Miller [description] => 13 miles of summer and winter trails. [site] => www.dcnr.state.pa.us [street] => Delaware State Forest [city] => Swiftwater [zip] => 18370 ) [22] => Array ( [id] => 24 [state] => PA [name] => Four Seasons Resort [description] => Camping resort in Southwestern PA, 800 acres with 26 miles of groomed trails for all skill levels. Ride from the campsite or room. This is a family campground with planned activities and special ATV events for the whole family [site] => www.campfourseasonsresort.com [street] => 3 Camp Resort Road [city] => West Finley [zip] => 15377 ) [23] => Array ( [id] => 25 [state] => PA [name] => Hilltop Lodge [description] => Motocross, Quad, and Dirt Bike Farm. You rent the lodge, farm, and all of the trails [site] => www.hilltoplodge.com [street] => 977 Moore Hill Road [city] => Emporium [zip] => 15834 ) [24] => Array ( [id] => 26 [state] => NJ [name] => Test [description] => This is a test [site] => Blah blah blah [street] => Street street [city] => happyville [zip] => 10002 ) [25] => Array ( [id] => 27 [state] => WA [name] => A second test [description] => This is in Washington [site] => Let's see what happens [street] => cleanthe screen [city] => citycity [zip] => 11111 ) )

  6. #21
    Join Date
    Mar 2012
    Posts
    16
    The images are just placeholder .gif files. They are identical in size and format, with different text on each (just numbers) so that I can see what is being displayed. They are stored in the maps file (as indicated in the code) and the names of the files correspond to the primary key ids of the items. So the file for item 1 in the array is maps/1.gif and the file for the fourth item in the array is maps/4.gif

  7. #22
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    792
    Ok, the data looks fine.

    As a test please could you replace your showImage function with this:

    Code:
    <script type="text/javascript">
    
    	var showImage = (function()
    	{
    		var prev;
    		return function(id)
    		{
    			if (prev) {prev.style.visibility = 'hidden';}
    			prev = document.getElementById('loadingImage' + id);
    			prev.style.visibility = 'visible';
    		};
    	}());
    
    </script>
    If this doesn't sort out the problem then I would like to get the stylesheet from you.
    JavaScript: Learn | Validate | Compact | bionoid

  8. #23
    Join Date
    Mar 2012
    Posts
    16
    That did it.

    I'm new enough that I don't know the procedure...you've put in a lot of time to help me. Is there something I can do in return? Some sites have a "thank" button to raise your reputation, or I can mention your website on Twitter or something.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles