On my website I have a simple shop where you can add items to your cart. To make things nicer, we have Javascript to handle the process to make it faster. The problem I am having is that Opera does not save the cookie that the javascript creates.
Here's the relevant code:
Code:
function createCookie(name,value,days){
var expires = "";
if (days){
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
}else
expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
Full code: [URL]
You can see it live if you go to [URL] click on "Kaupa" (Icelandic for Buy) on any item. You will see a nice simple animation once you do. Once an item has been added, a cookie is created but in my Opera 10.53 the cookie does not exist. Browsing any other pages will result in the cart being empty. What am I doing wrong? Works for every other major browser except Opera.
is there anyway way of saving a cookie of a certain website permanently ? there are some sites that offer cookies for each promoter. therefore even if the visitor goes through some other link of another promoter the details of the first promoter will be retrieved from the previous cookie.
I'm trying to get my form to save a user's data via cookies. I found a script at [URL], and it only seems to work if you refresh the page, but not if you close out the browser and restart.
I would like to code a couple of scripts for saving various data into cookies, and then post them to e-mail through a cgi script. To be more clear, I want to save some questionare's answers given through a series of html pages, to cookies. When (and if) the last question is answered, send all the answers to an e-mail address.
I have this code for collapsing div below. What I want to achieve is that when I go back to the page, it would remember whether the div was collapsed(style.display = none) or expanded(style.display = block). Here is the collapse/expand script:
Code: <script type="text/javascript"> function toggleDiv(div){[code]....
For some reason I cant get the values to save to database. Here is an example and have tried many ways to save. Works normal if the textbox's are already part of the page & is a normal form but does not save when document.createElement() is used.:confused:
Form.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "[URL]"> <html> <head> <script type="text/javascript">
function test(which){ var val=document.getElementById('prompt').getElementsByTagName('input'); for(var i=0; i<val.length-3; i++) { tbID='textbox' +(i+1)+'[' +which+']'; document.form0[tbID].value=val[i].value; } .....
I have a feature on my site that allows visitors to enlarge the text at the click of a button, and I store their preference in a cookie. This allows them to keep the same setting as they navigate around the site, or even if they re-visit another day. It works perfectly on Firefox 3.6, IE8 and Safari 4, but for some reason it won't work in Opera 10.
Here are the two links for changing the text size:
Question: I need a few good idea on the best way to save a webpage (even better a node of a webpage) in which a user has created new elements. (via javascript?)
Concept: User creates elements on a canvas (via Javascript) then has the option to save the layout of those elements. upon pushing save the Javascript packages the created and/or changed elements and sends then to the server to be processed by PHP and saved.
Hurdles: saved data must include style attibutes, text, child nodes and so on. The when other users view the page PHP will build the elements from the original user saved file.
What I have Done:I have managed to use Xmlserializer to output the "canvas" element in firefox and safri I have used .outputHTML in IE to complish the same thing.Of course there are a few differences when comparing the two strings, mainly having to do with commas.IE does not surround id's in commas and FF does. This has me thinking there has to be a better way more consistant way. on other ways to save dynamic elements using Javascript, and PHP.
I have a problem with cookies set via javascript. What I try to achieve is, when a user comes on the intranet, he can click on a link ( a simple href) that will set the content to french or english. I want to set a cookie to persist that choice each time the user comes back on the intranet. This feature must be available everywhere on the intranet and the link is placed in an inner asp script called Menu.asp which is included each time a page loads.
Now, I know it's maybe not the best way to achieve this but I'm just working from what has been made by others, I cannot change the way things are made, too much work would be involved and they won't accept to give time to do everything all over again.
The best approach I got was to set a querystring value and replace the cookie value from vbscript code. The problem is, the intranet we have use a lot of the querystrings for a lot of features and when I click the English/French link, that info is lost. I've tried to set a mechanism to keep all the querystring and only add a new value but I got weird results...
So I've turned to Javascript and still got no luck... For some reasons, the cookie gets deleted from the cookie file as soon as my javascript modifies the cookie.
I wrote a script to generate links to some pictures that I need to regularly update our site with. Is there a way to write a script that just saves the pics to a directory on my pc so I dont have to right click on every link and do a save picture as...? I can't link directly to the pics from our site because our site is https and the site the pics are on are http so the user gets the security warning box every time a pic loads. Code:
WANT: Client to save an image to disk pressing a "download" button. The image name is dynamic, from JS code on another part of the page
DID: Read somewhere I can use document.execCommand("SaveAs") to do it This solves it for MSIE, at least. My code is below
PROBLEM: What actually happens with MSIE is: 1) A window pops up promting me to save as.
2) The filename is correct, but the saveas type shown in the box is limited to "html" and "txt"
3) The "image" that is saved is not an image, but an HTML file containing the link to the image!! This is NOT what I want!
PLEASE help. How do I get MSIE to save the actual image instead? PS With netscape, instead of the saveas dialogue, a window opens with the image displayed. By clicking <CTRL-S> I can save the actual image.
I have a log file that is viewed on the local machine. There are some settings on the html page that allow the user to specify how the file is viewed. I'm just wnodering what are my options in saving these settings (so they could be reloaded next time the user loads the page). Writing to registry, a file, or a cookie? what's the right approach?
I've got an online system which I'm interested in making available offline - i.e. letting the user download certain HTML forms, fill them out offline, then the next time he logs into the site, sending all the data he filled out to the system. However, I can't seem to come up with a good way to do this. I thought of using cookies (that'd be great, since the system could detect them automatically), but it seems I can't set cookies for my server offline; it has to be from a page on the server itself. And from what I can tell, JavaScript doesn't have the capability to write files on a local system either. Does anyone have any ideas about how to go about this using JavaScript?
I am making a LOVE IT button using php and jquery and i have most of it working...
The button currently returns the value from the DB of 0 but when i click the button it wont save the incremented value to the DB.
see it here[URL]
my code is this
<?php mysql_connect("localhost", "web183-loveit", "password") or die ("Error."); mysql_select_db("web183-loveit") or die ("error"); $increase = "UPDATE results SET value=value+1 WHERE id=1;";
I have trying to save an update the xml file which is there in same folder in which HTML page is there. In HTMl page i have written javascript code to Save and Update XML on server.The code is like this
function Save() { var xmlDoc= new ActiveXObject("MSXML.DOMDocument") xmlDoc.async="false"
[Code].....
When i am accessing HTMl page on server from client and this function is called error 'Parameter is incorrect' is showing on line
I have created a 2D array as a sort of "game board" and would like to place an object(cubeShape) in each square and be able to interact with specific instances. Since I am using the O3D API, I would like to do this by taking the object's place in the transform matrix and storing it in the 2D array. The problem is, I run this code:
[Code]...
And then when I check it, every value in my array is filled with 9 instead of the actual count. i.e. myBoard[1,2] = 9, myBoard[2,2] = 9, etc. Whats going on?
I once came across some sites that prevent saving their pages by disabling the 'save' option in the File menu. I remember it was done. But I forgot the url.
How are they doing this? Is it possible to do so with Javascript? It will be great if someone provide me with links for such articles or scripts.
I want to save the form value for a persons USERNAME in a cookie when they are logging into my free e-mail service. So when they come back I can lookup the cookie and write the value for their username back into that spot in the form.
I've got it working for the drop-down menu so that it will change to whatever domain they selected the last time they logged in but I can't get it to work for the username box.
What I'm doing is taking the parts of my web site that apear on every page, for example the tags from the first <html> tag to the <body> tag, and I just put some JS code into an external file that tells it to write that same code to the browser, then I call the external file where I had the original code.
That way the external file gets cached and they don't have to re-download that part of the code every time.
Combining this, with some other things including gzip I've been able to get my main index page down to 300 bytes, not including images, css files or js files, which are only downloaded once because of caching anyways(and they aren't that big in size themselves, either).
Of course this wouldn't work if you don't want to alienate people who don't use javascript, but 9/10 people do so for some this might be helpful...
Also, this still works with dynamic content as well. for example what I did for my main page where I display the news in little "news boxes" as I call them which are basicly divs setup so they look nice visually... what I did was make a function in the external JS file that accepts the different parts of the news box such as subject, body, time/date of post and who posted it, and then it creates the HTML for it. Then it's really easy to change the look of the displayed news by just changing the js file.
I've been working on my code for some time but I know I'm missing the ability to save the completed time card entry to a file. Can someone assist me with the scripting code for this.I would like the user to be able to specify the location. I have search the forum and I have not found any question like this which surprises me. Please forgive me if I have posted in the wrong area.Currently I have no Java Script code to show for this part of my project because I'm completely stuck. But I have my unfinished XML code that is not pretty because I plan on using a style sheet to enhance. But here is the code for you to get and Idea of what i'm attempting.
Code: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html
I'm working on my last JavaScript project for school and have encountered a few problems. The two issues that I'm having with this script are: - The cookies only work in Internet Explorer; - I can't figure out the code to save the 3rd text input field as a cookie that will automatically change the background color to the user's fav color.
I need solution to change the url but not the page.
I need something like whan going to a site, the url changes to whatever, but there is no page count, so I just get the new (right) address, but when going back I go back to the page I came from. Secondly I dont want a back-trap.
Why?
Say someone opens www.mysite.com, end is gives index.php to the clinet - which enters a password and the browser offers to save that - later, when logged out, the client is sent to www.mysite.com/index.php, and the browser offers to save that password too... for another url, but still the same page...
I'm trying to save a PDF file that's built using the jspdf PDF JS files [URL], the example (server side) uses Jaxer to save the file to the hard drive. Can i do this via JQuery instead? PDF Example
i want to know if possible to save to file in the same mather of $(document).ready function () { $( '#reader') .load('Data/Le_Mensuel_1.txt'); }); or i have to use an outher function to save the content of my div(it is use like a Editable textbox)
i have used it for creating a table with Sorting and Paging. The table works perfectly without any issues per se except what i need now. I have used the following files: jquery-1.3.2.js, JQtable.js, and jquery.tablesorter.pager.js.
My problem is that there are links in 1 column of the grid. If a user clicks on the link, the user is redirected to another page. But when the user clicks on Back button, the Jquery Table always loads on the 1st Page with default settings and does not load the page on which the row wa present.
i need to go back to the same page of the table (from where the link has been clicked) with the same size for paging and sort order on clicking Back or a Link to the Page.
So in short - is there any pugin which we can use witht the jquery table to save the state and use it to load the table accordingly on Page Load?