HTML - Storing Somebodys Name From An Input Box In Cookies
hi all. i need this for an assignement so all help greatly appreciated. thank you in advance.
i just need to have an input box where somebody puts their name and then it displays it on the page using innerHTML and then it also remembers it for the next time they visit. also a cookie clearer would be good? if anybody knows of any code anywhere that might be commented to help me out that would be great. im finding it hard to search for this on google and throughout this forum. thank you again. this is what ive got already..... HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test</title> <script type="text/javascript"> //<![CDATA[ window.onload = init; function init() { document.getElementById("my_form").onsubmit = parse_form; } function parse_form() { var visitor_name = document.getElementById("visitor_name").value; var el = document.getElementById("message"); if (visitor_name) { el.innerHTML = "Welcome, " + visitor_name; } else { el.innerHTML = ""; } return false; } //]]> </script> </head> <body> <div id="message"></div> <form id="my_form"> <p>Please enter your name:</p> <input type="text" id="visitor_name" /> <input type="submit" value="Submit" /> </form> </body> </html> Similar TutorialsOk so here is my issue, i am new to web site design and i have a simple project i would like to work on. I am looking to have an entry box with a simple submit button, then i would like the submissions to be displayed below in the order they are submitted. I would also like to limit the number of submissions that show on the page at a given time by creating multiple pages that can be viewed. This seems like a very simple issue but im having trouble finding solutions on the web. Would inserting a java app or some other secondary tool be better? Any help is appreciated -Matt Hi What is wrong with this, it can't post text only post checkbox <html> <head> </head> <body> <FORM action="http://localhost:8182/items" method="post"> <P> <LABEL for="firstname">First name: </LABEL> <input type="text" value = "Hamada" id="firstname"><BR> <LABEL for="lastname">Last name: </LABEL> <input type="text" value = "I hate my life" id="lastname"><BR> <LABEL for="email">email: </LABEL> <input type="text" id="email" value = "I hate you"><BR> <INPUT type="radio" name="sex" value="Male"> Male<BR> <INPUT type="radio" name="sex" value="Female"> Female<BR> <input type="submit" value="Submit"> <INPUT type="reset"> </P> </FORM> </body> </html> Thanks Hi guys, I'm new to this forum and fairly new to html I've been asked to create a webpage for work that is pretty much an on-line diary for where plant & equipment has been. I have done all the easy stuff, but I don't know if it's possible to display and save input in a cronological order as a list. Is it possible to simply use html code and get this task done? To be more specific, the user can enter the arrival and deparature date of equipment, which i need to be displayed and saved. Any help will be greatly appreciated, and please keep in mind that I have limited knowledge with html code and JS. Regards, Daniel. Ok I had someone recently create me a new myspace layout. We will be using various images for the layout that I will be changing myself from time to time. He needs to know the file path of where I'll be storing these images on my server so he can link all the images correctly. I guess for right now I was just going to use my home computer as the server & just get the hosting? What do you guys think? Also when creating the file path, none of the folders that I want to use can have a space between the folder name right? Like it must be: AcidTripMedia Not Acid Trip Media Right? I must take all of the spaces out of the names of the folders I want to use? Cookies?! What are they and do I really need one? By the way, check this out www.esaurome.com/index.html and tell m what you think... Also, is it better to give files a .htm or .html extension? Any difference between the 2? Hi Guys, Hope this is the correct forum for this thread. How do you put a cookie on someones computer when they visit your website? Thanks I was hoping you could help me with a problem that came up at work today since I've never worked with this sort of thing before - cookies. This has to do with affiliate marketing. To put things short, my company uses cookies to track the referrer's username (ie the person through whom new users register). This is in turn tracked by our servers and the affiliates are paid a commission for every referral. Basically this process works perfectly in firefox, safari and chrome browsers but not in internet explorer. It seems to be quite random because it does work on the rare occasion but it mostly doesn't save the cookies that contain the username of the affiliate and therefore we cannot track the referrals made through internet explorer by the users. Do you have any idea or experience regarding this? By the way, this is done through a tracking url using redir.cgi and adding the values in the address itself (for example: http://www.---.com/cgi-bin/redir.cgi...le=123&lang=en). I've tried to research about what might be the cause of the problem but all I found were other people complaining that internet explorer gives problems but no solutions. Do you have any idea how this tracking works? Thanks a lot, I would appreciate your help hi, what is cookies and sessions .I have listen many times but don't know.. If u know plz tell. Thanks, web development Is there any way that cookies will work with frames that are showing a site on a different server? Help Me With Cookies, HTML and IE8 For complex reasons, I have to use HTML with JavaScript to set a cookie. I know it is easy to set and get cookies PHP but I have to put the code in HTML. I have searched the internet for some examples and I ran a test based on an example. I ran this Javascript code: Code: <SCRIPT LANGUAGE="JavaScript"> function putCookie() { cookie_name = "specialcookiehuge"; if(document.cookie != document.cookie) { index = document.cookie.indexOf(cookie_name); } else { index = -1; } if (index == -1) { document.cookie=cookie_name+"; expires=Monday, 04-Apr-2020 05:00:00 GMT"; } } </SCRIPT> I tested this code by placing alert statements and I nkow that the line: Code: document.cookie=cookie_name+"; expires=Monday, 04-Apr-2020 05:00:00 GMT"; gets run. I tried to find this cookie (Tools -> Internet Options -> Browsing History ->Settings) And I did not find anything named "specialcookiehuge" in "View Objects" or "View Files". I guess I could try other browsers, but it would be good to know what I am doing wrong. I do not know if I am really setting a cookie. Is there some additional javascript command I am missing? Or, is the cookie being set but I am not looking in the right place according to the tutorials I saw online? Hi, i have the following form, it doesnt do much: Code: <form method="post" > <INPUT TYPE=TEXT SIZE=40 NAME=data value=""> <br> <INPUT TYPE=TEXT SIZE=40 NAME=data value=""> <br> <input TYPE=SUBMIT NAME=data value="Login" > </form> I would like the values to be filled in by obtaining data from a cookie, the function which which gets the cookie data is the following: Code: function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if(c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } Just wondering if anyone could help me call this function from the form, so that i can fill in the values. Thanks Hello (this may sound like a confusing post), I have a website that I recently created, and am having some trouble with newly updated pages loading. I had the site set up and finalized, and I uploaded it through my ftp program. The site works fine, then I was instructed to change certain pages. Since I changed certain pages, I have to now refresh each page I go on in order to see the new updated pages (since I already viewed the page on my computer, and it's set in my cookies). I know that I can delete the cookies on my own computer, but I want people who don't know how to do that who have already viewed the webpage, to be able to come back to the site and automatically see the page updates. So in a nutshell - all I want to know is if there is a code I can place in my html that will make it so my site is not stored in anyones cookies. Thanks in advance to anyone who offers suggestions or advice!! Hello. I have a small script developed for tracking sales. The script randomly generates a "transaction ID" by creating a random number when a user visits the thank you page. It works great, however there is one problem: when a repeat user comes back, it generates a NEW transaction ID and logs a second "sale" when in fact its just a repeat visit. How can I modify this script to remember the transaction ID for each user? I was thinking creating a cookie with the transaction ID would be the simplest way, however I'm not sure. If you can help me decide which way is best, and then show me how to implement this I will be very greatful. Basically I think I would need some sort of second variable, and a script that runs to check for a cookie. If cookie is present, replace "$random_number" with "transaction ID". else if no cookie is present, generate a new number with $random_number. Heres the code: Code: <!------- Random Number Generator For Pixel ----------> <?php srand ((double) microtime( )*1000000); $random_number = rand(0,100000); echo "<script src='https://users.domain.com/sale_third/49.95/$random_number/OPTIONAL_INFORMATION'></script> <noscript><IMG SRC='https://users.domain.com/track_sale/49.95/$random_number/OPTIONAL_INFORMATION'></noscript>"; ?> <!------- End Random Number Generator For Pixel ----------> Thanks in advance. Hi, I have a final project due in 3 hours for javascript class. I need to use cookies to change a stylesheet on a page and keep it consistent on every page until the user changes it. The link is http://www-scf.usc.edu/~javery/itp204/finalproject.html Its a dumb page about my cat. Anyway if you view the source, a lot of the javascript is for the style switch. The user is supposed to switch styles and click Save Style and then it sets that style for every other page. The code is in the other pages too. The style switches but it doesnt save. If anyone can help me it'd be much appreciated! Joel Could someone please tell me how to update or change a visitor's Cache and/or Cookies when they visit my web page. My company has requested numerous updates to the site since it was launched and they are worried some of their clients won't see the changes because they visited the page before the changes were made. The site was created in Flash and is nested in one HTML page. Thanks in advance. Hi. I am trying to create a page containg 2 frames, right frame, and mainFrame. I am using the right frame to allow users to click links to remote sites browsable within the mainFrame. However, most of these sites require cookies and keep opening links in a new window. Is there a way to enable 3rd party cookies within frames, and to also disable links within the mainFrame from opening in a new window? p.s. I know Firefox allows users to use 3rd party cookies in frames. Thanks Hi, I'm a newbie. I would like to know how do I display 2 labels and both inputs in the same row as shown in the attachment like state followed by input field followed by label for zip and followed by input within the same row of table in a form. Thanks in advance yls How do i save input from a client into a file on my computer? Code: <html> <head> <title>Register</title> </head> <form> Username: <input type="text" name="username"> <br> Password: <input type="text" name="password"> <br> Retype Password: <input type="text" name="confirmpass"> <br> <input type="submit" value="Submit"> </form> </html> - End - How do I store the input from the user? (username,password,confirmpass) Thank you -HTMLMW |