Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 28th, 2011, 07:29 AM
Authorized User
Points: 89, Level: 1
Points: 89, Level: 1 Points: 89, Level: 1 Points: 89, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2011
Posts: 21
Thanks: 9
Thanked 0 Times in 0 Posts
Default truble with the cookie part, can anyone help?

Hi,

I manage to swap images by clicking on thumbnails.

What I dont manage, is to save the last selected image into a cookie.

Can anyone help me solve this? Would appreciate it!


HTML Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script
<script>
$(document).ready(function () {
   var checkCookie = $.cookie("panel");
   if (checkCookie != "") {
     $('#panel a:eq('+checkCookie+')').next().show();
   }   $('.panel-version a').click(function(e){
       var src = $(this).attr('href');
       $.cookie("panel-version", href);
   }); });
</script>
</head>
<body>
<script type="text/javascript"> 
jQuery(function(){	
		$('#panel a').click(function(e){
		var src = $(this).attr('href');
		$('.panel-version').attr('src',src);
		e.preventDefault();
		});	});
</script>
</div>		  
<div class="panel" id="panel">
<img src="img1.png" alt="" class="panel-version" />
<h3>Panel colors</h3>
<ul id="nav">
<a href="img1.png"><img src="img1.png" class="panel1" alt="HTML tutorial" width="32" height="32" /></a>
<a href="img2.png"><img src="img2.png" class="panel2" alt="HTML tutorial" width="32" height="32" /></a>
<a href="img3.png"><img src="img3.png" class="panel3" alt="HTML tutorial" width="32" height="32" /></a>
</ul>
</div>
<img src="img1.png" alt="" class="panel-version" />
<img src="img1.png" alt="" class="panel-version" />
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old September 29th, 2011, 04:14 AM
Authorized User
Points: 89, Level: 1
Points: 89, Level: 1 Points: 89, Level: 1 Points: 89, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2011
Posts: 21
Thanks: 9
Thanked 0 Times in 0 Posts
Default

I found a solution, clap clap.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a web part to a SharePoint web part page sawanjc BOOK: Beginning SharePoint 2007: Building Team Solutions with MOSS 2007 ISBN: 978-0-470-12449-9 0 July 15th, 2011 04:37 PM
Cookie question janilane BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 November 5th, 2009 03:18 AM
Cookie prv299 ASP.NET 2.0 Professional 3 May 29th, 2008 11:26 AM
Cookie Questions Ron Howerton ASP.NET 2.0 Professional 15 November 13th, 2007 09:32 AM
login cookie help daddycool2k ASP.NET 1.0 and 1.1 Basics 0 November 16th, 2003 02:17 PM



All times are GMT -4. The time now is 06:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.