Jump to content

Fpad77

Members
  • Posts

    8
  • Joined

  • Last visited

Fpad77's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Heh, it doesnt matter, dont think I'll go for the javascript popup thing because it might send pop-up blockers on the alert.So what I am going to do, is when you click the item, on the next page it tells you that you found it and it also writes the cookie. But because I can't work out how to set the cookie instantly as well as showing the item in the inventory, all I am going to do is just have it set in there manually, so it doesn't matter because as soon as the user goes to the next page it will be place by the response from the cookie, saves me the trouble haha.Cheers.
  2. Hmm, odd on my end clicking the lock isnt functioning at all, I'll check it out.
  3. The scary thing is, its not lolol.heres a quick test:http://www.adamhartwig.co.uk/mystuff/testing/testing/for now i put the lock image as what is supposed to be the javascript, but its not functioning as a button at all
  4. AAah lol, im having an odd problem opening up the new window in the .php, its works for me before, I ain't used it in a long time because I've never been so keen on forcing open a separate window.Can you see anything wrong with the code here because something is completely flying past me and I can't work it out:<script type="text/JavaScript"><!--function MM_openBrWindow(theURL,winName,features) { window.open(theURL,winName,features);}//--></script></head><body><img src="images/locked.png" alt="Its an item!" width="98" height="98" border="0" onclick="MM_openBrWindow('keys.php','key','width=300,height=300')"/> It works absolutely fine with html. Sorry to keep on bothering you haha, if I'd done this part all in flash it'd be really easy for me but I'm just keeping my design alot more dynamic, and trying something a bit new to me at the same time. Am used to my lubbly html haha.Adam
  5. Thanks very much for your help.Adam
  6. I see your thinking .Could you fill me in on the code to reload the parent page at the same time, else i'll just have to scout around a bit, but seeing as ur here :)Ta for the help btw
  7. Hey thanks for the response, aye I had a look around at things, and here's what i come up with as a tester just to get the image to swap correctly. The cookie is set instantly.<?php setcookie("foundkey", "foundkey",time()+3600); $file_type = ".png"; $image_folder = "images"; $href = "keys.html"; $href2 = "#"; $image_name = keys . $file_type; $no_image_name = blank . $file_type; if (isset($_COOKIE['foundkey'])) { echo "<a href=\"$href\"><img src=\"$image_folder/$image_name\" alt=\"You've got the key!\" /></a>"; }else{ echo "<a href=\"$href2\"><img src=\"$image_folder/$no_image_name\" alt=\"You need to find the item first!\" /></a>"; }?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Test</title></head><body><a href="index.php"><img src="images/locked.png" alt="Its an item!" width="98" height="98" border="0"/></a></body></html> Ignore the last bit about the item. Seeing as i cant seem to be able to get around making the cookie be set when the item is clicked. I thought perhaps the best way to do it is when the item is clicked you go to the next page and the cookie is set instnatly then.Would you be able to help out in how I would set the cookie first then use it to make the it show up in the inventory straight away without having to go to another page again/reload?I looked on one of the sites you posted about cookies and saw someone stating something like that but I couldnt work it out.So like: click the item, it sends you to a new page saying 'you got the key', but at the same time a cookie has been set and it shows up in the inventory straight away.. is it possible? lol.
  8. Hi there, for my portfolio site I am adding some little extras, one is that the user has an inventory. What I am trying to do is get it so that when they find an item they click it, which is then added to their inventory on the left and allows them to access secret areas of the site.I have the code sorted for reading the cookie to see if they have the inventory which is as follows (main part of it): if(isset($_COOKIE['gotkey1'])){ echo "<a href=\"$href\"><img src=\"$image_folder/$image_name\" alt=\"You've got the key!\" /></a>"; }else{ echo "<a href=\"$href2\"><img src=\"$image_folder/$no_image_name\" alt=\"You need to find the item first!\" /></a>"; } The problem is now, Ive tried some methods to write the cookie when the 'item' is clicked on but it doesn't seem to be working.What is supposed to happen is that the user clicks the item, the cookie is written and then it takes them to a new page saying 'you found the key etc etc', at which point you will then be able to see the item in the inventory from the above code.Does anyone know how I can attatch it so that a cookie is written when an item is clicked.Help!Cheers,Adam
×
×
  • Create New...