Results 1 to 3 of 3

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User cecko19's Avatar
    Join Date: Jan:2011
    Location: Sofia
    Posts: 82

    jQuery + JSON

    !
    , , , , , . slideshow . jQuery javascript , - .
    :
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stict//EN"
    		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    	<head>
    		<title>jQuery</title>
    		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>	
    	</head>
    		
    	<body>
    		<button id="change">Press Me!</button>
    		<script>
    			$('#change').click(function()	{
    				$.getJSON('json-db.html', function(data)	{	
    					setInterval('changePic()', 1000);
    				
    					function changePic()	{
    						for(var i = 0; i < data.images.length; i++)	{
    							$('div').remove('imga');
    						
    							var image = data.images[i];
    							$('#resultDiv')
    								.append('<img id=' + '"' + 'imga' + '" ' + 'src=' + '"' + image.source + '" ' + "alt=" + '"' + image.alternative + '"' + ' />');
    						}
    					}
    				});
    			});
    		</script>
    		<div id="resultDiv"></div>
    	</body>
    </html>
    , FireBug-a , changePic() . .

    ..: , ...

  2. #2
    hmm BornToDrink's Avatar
    Join Date: Aug:2005
    Location: .
    Posts: 11,573
    .
    <script>.
    Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
    .

  3. #3
    Registered User cecko19's Avatar
    Join Date: Jan:2011
    Location: Sofia
    Posts: 82
    ! . ...

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |