Create Cookie When Link Clicked And Use It As Settings?

Mar 12, 2009

I use javascript to create a cookie when you click a link
<a href="#" onclick="document.cookie='settings=blue; expires=31/03/2009;'">Blue</a>
This creates a cookie and I can get it back easily but I want to use it as settings. I have 3 folders of pictures white blue and pink the user will click the link selecting there colour creating a cookie. Now when the page finds the cookie it needs to place the output in to the path.
<img src="pictures/ !!!output!!! /something.png">

So far I have this (just a trial)
<script type="text/javascript" src="cookie.js">
</script>
<script type="text/javascript">
function image(){
settings=getCookie('settings');
if (settings!=null && settings!=""){
document.write('<img src="'+settings+'.png">')
}}document.write(image())
</script>

This works but next to the image it says undefined so how would I get rid of it?

View 3 Replies


ADVERTISEMENT

OnClick :: Create A Cookie For The User That Adds The Link Id ?

Jun 15, 2011

I have a website with five links, each with its own id. onClick I would like to create a cookie for the user that adds the link id that they have clicked.I am planning to do this using an array, however, I am a bit confused about the theroy behind a cookie.It is just a text file that can hold any data correct? So I could store an array with

array[0] = hi.html
array[1] = hello.html

and later on pull up what is in array[0] to diplay it on the page? Can I do this with one cookie or would I need a new cookie for each link?

View 2 Replies View Related

Adjust Font Size - Cookie To Save Settings?

Apr 4, 2008

I have a Javascript used to adjust the fontsize on a webpage. This JS does not create a cookie to save the users setting, so if he goes to another page on the site, the default font size is shown.This is the JS;

Code:
var min=8;
var standard=11;
var max=15;[code]..........
What I need, is some code that will create a cookie, so that the users settings will be used throuout his whole visit.

View 13 Replies View Related

How To Create A Text Link To, When Clicked, Will Take The Value Of A Pull Down Box?

Jul 30, 2005

I have a form with several pull-down menus. I want to give the user the option of learning more about the choice they have made in a pull-down menu.

I'd like to create a text link that takes you to a page with the parameter which is the index number of the pull-down menu. I'd also like it to open in a new window.

How do get that value as a parameter to use in a link?

Here's some code I am working with: Code:

View 3 Replies View Related

JQuery :: Use To Write To A Cookie To Tell It What Image Map Coord Was Clicked So The Correct So The Correct Div In The Clicked To Page Opens?

Dec 26, 2011

[URL]..Default.aspx I have both a carousel with images andalso animagemap(notnot published yet)with coords that when clicked i want to write to a cookie file which image or image map coordinate was clicked, so when they are hyperlinked to the next page the correct div opens based on first reading the cookie written to on the previous page. Anybody have a basic script for reading and writing to a cookie using jquery in this fashion?

View 2 Replies View Related

Link Tracking - Counter That Will Display Beside A Link With The Number Of Times The Same Link Has Been Clicked

Feb 16, 2009

I need a counter that will display beside a link, with the number of times the same link has been clicked. I do not have FTP access to the site, since it is based on a CMS.

View 1 Replies View Related

Jquery :: Find Which Link Is Clicked - List Of Records With Link With Each Record

May 17, 2009

I have a list of records with link with each record

I have like this table structure:

After that dynamic tr and td are created which list the name of cateogy and its image

<a id is dynamic i want when i click this image link i get the value of which link is clicked

View 4 Replies View Related

Store A Cookie To Skip Show It To Persons That Already Clicked On It?

May 8, 2011

Do you know how is it possible insert a windows that contains text (terms of use) and that block and turn dark the page until you click on the "accept" button?

And if possible store a cookie to skip show it to persons that already clicked on it.

View 6 Replies View Related

Create Cookie And Use Its Value On Another Page?

Nov 3, 2007

i am trying to create a cookie in a page, and use the cookie value in another page, but it does not work, could anyone tell me why? Code:

View 2 Replies View Related

JQuery :: Create Copy Of File On Server Change It And Create Download Link On Page?

Dec 16, 2011

I have files on the server: .txt, .xml, .config, and "no extension" - all editable with notepad.

User will write some input, it will be added to file in specific place.

I need an ability to change element value in file (in one of them - depends what user choose) (or it even can be some trigger word it-self like CHANGE_ME for not to use attributes)

Create a temporary copy of edited file and create a unique temporary link to it.

I don't know what to start from.... For now I know how to make XHR, but what to do with other extensions?

Have no idea how to save the NEW file (a copy of original file) on server , and create a UNIQUE link ,and delete the file right after it was downloaded.

I can find a specific word in xml file, but how to change it?[code]...

View 3 Replies View Related

Create A Cookie And Check Whether It Exists?

Sep 14, 2011

I have created a popup at the following page:
http://suawg.osugv.servertrust.com

If i click on 18+ then it gets redirected to http://suawg.osugv.servertrust.com/default.asp

if i click on i am not 18 then it gets redirected to google.com

if i have chosen 18+ then the cookie should be created and if by mistake i again go to http://suawg.osugv.servertrust.com that is popup page it should get redirected to http://suawg.osugv.servertrust.com/default.asp

View 1 Replies View Related

Create Cookie From Class Name Change?

Jun 9, 2011

I'm employing a javascript function that adds a class name to a div, so I can alter the font size of the page... simple enough!

However, I'm stumped as to creating a cookie that will remember this new classname and employ it sitewide, instead of resetting it as soon as I reload or navigate to another sitepage.

I've hashed something together to try and get this to work... font increase is working fine, the cookie part is not.

code is as follows:

HTML Code:
<html>
<head>
<SCRIPT>

[Code]....

View 6 Replies View Related

Create A Cookie On The Client And Let The Server To Retrieve It?

Jul 8, 2009

id like to know how can i create a cookie on the client side as well as to script my server side coding to retrieve the cookie value.

View 1 Replies View Related

Create A Cookie To Remember Selected Language?

Apr 27, 2010

Here's the website code...

Id like to make it to the site remembers whether someone choses the english or french version of the site. How hard is it to do something like that?

Can it be done in javascript?

View 8 Replies View Related

JQuery :: AddClass To A Link Based On Cookie Value?

Jan 21, 2011

I have a server side include navigation using classic ASP. I tried to use jQuery cookie which I store the id of the link clicked into it in order to asign a class on that link but not on the current page but on the page that the link is pointing!

View 8 Replies View Related

Jquery :: Save Multiple Cookie For Every Link

Oct 1, 2011

I have lots of links in the page, click each one addClass 'voted' to this link. then save the effection into cookies. so that next time refresh web browser, it will save the addClass event. I use jquery cookie here: [URL] My code here, but it will only save 1 cookie. I mean if I clicked link 1, link 2. it always remember the last click. refresh the web browser. only link 2 addClass 'voted'. link1 missed addClass event. so how to save multiple cookie for every link?

[Code]....

View 7 Replies View Related

Setting A Cookie When User Clicks A Link And Prevent Default?

May 29, 2011

I'm trying to set a cookie when a user clicks a hyper link.

Do you think I should prevent the default behavior of pressing a link first, and then set the cookie?

Or could I just set the cookie on a hyper link click event, and hope the client sets the cookie, before they are directed to another page.

View 3 Replies View Related

How To Detect When A Link Is Clicked

Jul 20, 2005

How can I detect when a link has been clicked but the new page is
still in the process of loading? The document.location.href property
still displays the current location (understandably) not the one
that's about to load.

I have a page that reloads every 30 seconds in order to access live
data. If a user clicks on a link just prior to the page reloading the
reload takes precedence over the link click and this is annoying for
the users. Whe the page is about to reload I want to check to see if a
link has just been clicked (and therefore a new page is about to load)
and, if so, cancel the reload.

View 1 Replies View Related

Print The ID Of A Link When Clicked?

Jan 12, 2011

I have a page with several links that when clicked open a modal window. The same window for each link, with a form. However inside the form I need to print the id of the link that was clicked. Like so:

<a href="#" id="1">Link 1</a>
<a href="#" id="2">Link 2</a>
<a href="#" id="3">Link 3</a>[code]............

View 7 Replies View Related

When The Link Is Clicked, Want It To Get A Border Around It?

Nov 4, 2009

I have a link, which triggers a script, but when the link is clicked, i want it to get a border around it... currently tried onclick="this.style.borderWidth = 1px"

View 4 Replies View Related

Creating New Div's When Link Is Clicked?

Oct 29, 2009

So I am trying to set up a registration form that when the user clicks the "Add Another" link then a new text field for the additional person and email field is added to the page. I dont know how to repeat this process to get what I want.

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.1EN"
"http:www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head>
<title>Registration Form</title>
<meta http-equiv="content-type"

[Code]....

View 2 Replies View Related

Add Fields When Link Clicked

Jun 26, 2007

What i want is when the user clicks on a link then another field is added so they can add another job. I want to keep it on the same page.

View 3 Replies View Related

When The Image Is Clicked, It Will Act Jst Like A Link?

Jan 26, 2011

I have a question and I think javascript is the way to go...So here's what im thinkingI have an image of half a quys face. When the mouse goes over it, the image should expand to reveal the whole face, when the image is clicked, it will act jst like a link.

View 6 Replies View Related

Create A Timer That Closes A Modal Box And Then Jumps The Url That Was Clicked On In The Html?

Jul 9, 2010

I need to create a timer that closes a modal box and then jumps the url that was clicked on in the html.

View 1 Replies View Related

JQuery :: Effect Whenever A Link Is Clicked?

Sep 17, 2009

I have navigational links on my page, but when someone clicks one, i would like an effect to occur, and then the browser to navigate to the link and it usually would.

[Code]...

View 5 Replies View Related

JQuery :: Getting Div Class Near Clicked Link?

Jan 25, 2011

Lets say I have a function that is going to be called when a link is clicked like so:

<a href="javascript:someFunction();" >Click me</a>
<script type="text/javascript">
function someFunction()

[code]....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved