|
Post by bfr on Nov 27, 2005 14:53:40 GMT -5
You can see more of VDesign's examples here. The examples included so far are in the following languages: C++ C# Basic The C++ is more of a console application while the C# and VB examples have more of a "Windows" feel. Feel free to comment or ask questions. Make it so that somebody besides me is posting in this board! (Note: I think the .NET framework is required for the C# and VB examples)
|
|
|
Post by bfr on Dec 3, 2005 17:26:32 GMT -5
Here is a Javascript cookie example (double-posting to make a receant post and to make the forum seem more active)
Also, before I post my example, the no double-posting rule is only meant for huge communities with lots of new threads each day, and they just don't want old ones getting bumped. None of the topics here are relaly active, so there isn't really a need for the no double-posting rule.
Anyway, here is a basic cookie example.
First, create a file called "cookies.html", and enter this:
<html> <body> <script> function setCookie() { var the_name = prompt("What's your name?","");
var the_cookie = "wm_javascript=" + escape("username:" + the_name);
document.cookie = the_cookie;
alert("Thanks");
} setCookie(); </script> <a href="C:\Documents and Settings\Owner\Desktop\setcookie.html">Continue</a> </body> </html>
and save it to your desktop. (The URL that the word "Continue" links to may need to by altered accoring to your OS)
Then, create a file called "setcookie.html" and type this into it:
<html> <body> <script> function readCookie()
{
var the_cookie = document.cookie;
var the_cookie = unescape(the_cookie);
var broken_cookie = the_cookie.split(":");
var the_name = broken_cookie[1];
alert("Your name is: " + the_name);
} readCookie(); </script> <a href="C:\Documents and Settings\Owner\Desktop\cookies.html">Back</a> </body> </html>
(The URL that the word "Back" links to may need to by altered accoring to your OS)
save it to your desktop. When you view cookies.html, you get a prompt. Enter "myname" and press OK. Then click "Continue". You are directed to setcookie.html, which was an alert that says "Your name is: myname". You can click "Back" to do the process again. That should teach the basics of Javascript cookies.
I'd be happy to answer any questions or comments, although I doubt anybody's going to ask any because practically nobody besides me posts in this board =p and this forum kind of died within the past week.
Also:
I was kind of in a rush when making this, so that's why I didn't use <script type="text/javascript"> or the script block.
btw the live preview code is very buggy, and really messed up when displaying the preview of this code. HTML code messes it up.
|
|