|
Answer» Hi there. I have a style question (I think it has to do with that). I would like to have a page, where you see on the center of the screen a red text box that is showed on the front of the site, and if you click on ok, you see my normal site again, and the message box desapair. Does anyone knows how to do this (perhaps with style.css)
P.S. If my explenation wasn't that clear watch the picture I paintedHow about:
<div style='position: absolute; z-index: 10; left: 300px; top:200px; width:200px; border: 3px outset #000000; background-color: #FF5050; padding: 5px;' onClick='javascript: this.style.display="none";'> <p>Read this message then click anywhere in this box to dismiss...</p> </div> That isn't really a good code. But it really is the text box I want, but my problem is, my whole website is displayed in that box now. And that isn't really my intintion. I want that the box comes on the front (RIGHT in the center, like your code does) and that if you clikc on it that it disapears (like your code does) but that the message is in the front, and that my whole website can be on the back....Did you miss the closing tag? Put that right at the start or right at the end of your HTML, and it should work as you want it to.right, my fault... Do you know how you let disapear this box, by an link example if I click on the word close in the box, it disapearsYes, you can try this:
<div style='position: absolute; z-index: 10; left: 300px; top:200px; width:200px; border: 3px outset #000000; background-color: #FF5050; padding: 5px;' id='tobeclosed'> <p>Read this message...</p> <p onClick='javascript: document.getElementById("tobeclosed").style.display="none";'> Close <p> </div> Perfect, your the best . Do you know (because this box was a saluting box) how that you make that the box only shows the first thime when I come on that page (that shows the saluting box).Absolutely. PHP + cookies. I'll put something together, but it probably won't be until tomorrow. Feel free to experiment in the meantime.Okay, the cookie based code must be right at the top of the page, before any headers are sent from the server. The first lines of your php script should be something like:
<?php $expiry = 2147483647; // expiry date of cookie - 19/01/2038 $now = time();
if (isset($_COOKIE['seenmessage'])) { // Check the value of the cookie. If it's less than // 20 seconds ago, show the message anyway if ($now < ($_COOKIE['seenmessage'] + 20)) { $showmessage = true; } ELSE { $showmessage = false; } } else { // No cookie - so set it; and show the message $showmessage = true; setcookie('seenmessage', $now, $expiry); } ?>
Then in the part of the page where you show the message, wrap it all in a php test:
<?php if ($showmessage) { ?> <div style='position: absolute; z-index: 10; left: 300px; top:200px; width:200px; border: 3px outset #000000; background-color: #FF5050; padding: 5px;' id='tobeclosed'> <p>Read this message...</p> <p onClick='javascript: document.getElementById("tobeclosed").style.display="none";'> Close <p> </div> <?php } ?> perfect, do you know a code (under php4) that deletes the cookie if you click on a link (so that if i click on log out, the cookie deletes itselves, and when I LOGIN back, I see the message again)To delete a cookie, you have to unset its value. You can only mess with cookies before any headers are sent, therefore you'd have to USE a link that diverts to another page. E.g.:
<a href='clearcookie.php'>Clear cookie[/url]
And the clearcookie.php has at the start, e.g.:
<?php
setcookie('seenmessage', false);
?>
I have a new question. How can you show the message again (if it is CLOSED)? I'd like to have the following thing:
?">+[/url] text
If you push on the plus, it wil show the message: text If you push a second time, the plus will become a min ( - ) and than the message: ok will be shown If you push again on the min, it become a plus, and the message text will be shown ....
Does anybody know this how to do
P.S. If you can help me, please use tables, so I can put more text (even perhaps pictures) in the box..
Thanx
blackberry 8-)I know how to do this, but give me a while. It's Easter weekend. Is there anything you don't know Rob? Take a well earned break. Hah. Fed, my knowledge is painfully limited. There are plenty of people on this site far more competent than I - you included.
But as for this area which I do understand...
Blackberry - so we're attacking this from a slightly different angle now. Here's a link to a site I designed quite a while ago. It's poor. But in my defence, I am currently working on a complete update: Ellis & Co.. (The new site that I'm working on is here, if you're interested.)
The thing that you want to look at is the menu on the left hand side - the folder icons, etc. This is pretty similar to what you want to achieve, and you can adapt the javascript to suit you. The script is >here<. Please keep the copyright notice intact if you use this as-is, or retain some kind of accreditation if you modify the code a little.
|