Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
redisplaying correct image after back button is pressed
Old 02-17-2006, 02:06 PM redisplaying correct image after back button is pressed
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Hi

Im a little bit stuck with a javascript function i wonder if you can help. The code posted below is a snippet from a page on my site where a user essentially selects an image with a select menu, then when they hit submit the image they chose is redisplayed on the following page. My problem with this is that if the user hits the back button so they arrive at the first page (where the select menu is), the image theyve chosen has reset. Ive got the select menu text to hold the correct value its just the image always reverts to default. Can anyone show me how to arrange my javascript code so that the correct image is always displayed if the user hits the back button after submission?

Thanks in advance
HTML Code:
<SCRIPT LANGUAGE="JavaScript" 
TYPE="text/javascript"> 
<!-- 
if(document.images) 
{ 
hingecol = new Array() 
for(i=0;i<10;i++) 
{ 
hingecol[i] = new Image() 
hingecol[i].src = "http://www.webmaster-talk.com/images/hingecol" + i + ".gif" 
} } 
function glassauto1() 
    { if(document.images) { 
    
    document.hingecolswitch.src = "http://www.webmaster-talk.com/images/hingecol"+document.hingeform.hingeglass.selectedIndex+".gif" 
    } } 
    window.onerror = null;
						 
function no() {hinge.style.visibility='visible';
               binge.style.visibility='hidden';}
function yes(){binge.style.visibility='visible';
               hinge.style.visibility='hidden';}
 
//--> 
</SCRIPT>

<form action='gethingeinfo2.php' NAME='hingeform' method='post'> 
<SELECT NAME='hingeglass' onChange='glassauto1()' class='dropDownBoxGrey'> 
<option value='Silver Mirror'    ";  if ($_SESSION[hingeglass] == "Silver Mirror")    {echo"selected";} echo">Silver Mirror
<option value='Dove White'       ";  if ($_SESSION[hingeglass] == "Dove White")       {echo"selected";} echo">Dove White
<option value='Flame Red'        ";  if ($_SESSION[hingeglass] == "Flame Red")        {echo"selected";} echo">Flame Red
<option value='Orchard Green'    ";  if ($_SESSION[hingeglass] == "Orchard Green")    {echo"selected";} echo">Orchard Green
<option value='Ocean Blue'       ";  if ($_SESSION[hingeglass] == "Ocean Blue")       {echo"selected";} echo">Ocean Blue
<option value='Metallic Blue'    ";  if ($_SESSION[hingeglass] == "Metallic Blue")    {echo"selected";} echo">Metallic Blue
<option value='Titanium'         ";  if ($_SESSION[hingeglass] == "Titanium")         {echo"selected";} echo">Titanium
<option value='Sky Blue'         ";  if ($_SESSION[hingeglass] == "Sky Blue")         {echo"selected";} echo">Sky Blue
<option value='Jet Black'        ";  if ($_SESSION[hingeglass] == "Jet Black")        {echo"selected";} echo">Jet Black    
<option value='Bordeaux'         ";  if ($_SESSION[hingeglass] == "Bordeaux")         {echo"selected";} echo">Bordeaux
<option value='Fuschia'          ";  if ($_SESSION[hingeglass] == "Fuschia")          {echo"selected";} echo">Fuschia
<option value='Lilac'            ";  if ($_SESSION[hingeglass] == "Lilac")            {echo"selected";} echo">Lilac
<option value='Primrose'         ";  if ($_SESSION[hingeglass] == "Primrose")         {echo"selected";} echo">Primrose
<option value='Chromatic Blue'   ";  if ($_SESSION[hingeglass] == "Chromatic Blue")   {echo"selected";} echo">Chromatic blue
<option value='Beige'            ";  if ($_SESSION[hingeglass] == "Beige")            {echo"selected";} echo">Beige
<option value='Orange'           ";  if ($_SESSION[hingeglass] == "Orange")           {echo"selected";} echo">Orange
<option value='Sunshine'         ";  if ($_SESSION[hingeglass] == "Sunshine")         {echo"selected";} echo">Sunshine
<option value='Blue Mirror'      ";  if ($_SESSION[hingeglass] == "Blue Mirror")      {echo"selected";} echo">Blue Mirror
<option value='Grey Mirror'      ";  if ($_SESSION[hingeglass] == "Grey Mirror")      {echo"selected";} echo">Grey Mirror
<option value='Frosted Classic +'";  if ($_SESSION[hingeglass] == "Frosted Classic +"){echo"selected";} echo">Frosted Classic +
</select>		
You can view the page working if you go to www.thedoorstop.co.uk. user:aluminium password:bagel. Its the 2nd page on the hinged doors section.

Last edited by hiptobesquare; 02-17-2006 at 02:12 PM..
hiptobesquare is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-20-2006, 12:15 PM Re: redisplaying correct image after back button is pressed
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Its ok ive figured it out now. It was nothing to do with javascript just a little php
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to redisplaying correct image after back button is pressed
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16050 seconds with 12 queries