473,508 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default Function Value from a Cookie

When my page loads, I check for the existence of a cookie value through
readCookie(). If there is a value present for the cookie, I would like
that to be the default value in function ordering() and that value to
be the SELECTED value in ddlProfileNames. In other words, if there is
no cookie value, then function ordering will default to
ordering("Div1,Div2,Div3,Div4"). If there is a value, then that should
be used in function ordering and as the default value in
ddlProfileNames. Thanks for any help.

<body onLoad="readCookie('default')">

<FORM name="frmProfileNames">
<SELECT class="smalltext" id="ddlProfileNames"
onChange="ordering(this.options[this.selectedIndex].value);">
<option value="Div1,Div2">1 & 2</option>
<option value="Div3,Div4">3 & 4</option>
<option value="Div1,Div2,Div3,Div4" SELECTED>All Sections</option>
</SELECT>
<a href="#" onclick="setCookie('default', 30);return false">Save as
Default Profile</a>
</FORM>
<SCRIPT>
function ordering(sorder)
{
// code here
}

// start things off:
ordering("Div1,Div2,Div3,Div4");

</SCRIPT>

Mar 1 '06 #1
1 1587

ev*******@gmail.com wrote:
When my page loads, I check for the existence of a cookie value through
readCookie(). If there is a value present for the cookie, I would like
that to be the default value in function ordering() and that value to
be the SELECTED value in ddlProfileNames. In other words, if there is
no cookie value, then function ordering will default to
ordering("Div1,Div2,Div3,Div4"). If there is a value, then that should
be used in function ordering and as the default value in
ddlProfileNames. Thanks for any help.

If the cookie has a value, loop through all the values in the select
and compare
them to the cookie's value. If a match is found, set the selectedIndex
property
to the current value of the loop counter and optionally call
ordering(), passing the currently indexed value as the parameter.

--
S.C.

Mar 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2911
by: lawrence | last post by:
I've this function, which is the method of a class. I'm posting the constructor of the class down below. For some reason, when I fill out a form and hit submit, I'm not getting any values. Can...
4
2753
by: Yvan J. Gagnon | last post by:
I am encountering a strange problem in Netscape 7 with a CFM file I am trying to troubleshoot (the page is working fine in NS Communicator and IE). Below is a sample of the problematic line of...
3
1202
by: ldixon789 | last post by:
I'm trying to convert an on load event into a function. I think this should be really simple, but I'm new to Javascript. The following works fine as the page loads var favorite =...
2
2639
by: shree | last post by:
Hi all, I'm trying to call javascript function via onLoad but running into a problem. I would appreciate any help and suggestion. My application is as follows. When a page loads, I want to check...
1
2031
by: mens libertina | last post by:
Hello, I am programming a little game, and I want the focus to move from one input box to the next as the user types. I have image-input pairs so the user is typing a letter under a picture. ...
4
6132
by: jojowebdev | last post by:
I see how the window.opener works, pretty neat in that the pop window knows the parent. Is there a property that also knows the form field parent? My function does not know which of the 3...
10
8133
by: Victor | last post by:
hi guys. In my project, now I am using a asp.net login control and a customized membership provider to do the form authentication. Now I want some function that user can skip the login form and be...
4
2452
by: dk9 | last post by:
The Situation: I'm working in my browser at a secured site (https). At the same time I need my application to get and parse some urls from that same site. What I've tried: I've login with my...
2
1663
by: printline | last post by:
Hi all I have a problem with a form script. The form script should do the following: When a user selects a value from a drop down list and hits the "next" button it should take him to a...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.