473,785 Members | 2,824 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="readCoo kie('default')" >

<FORM name="frmProfil eNames">
<SELECT class="smalltex t" id="ddlProfileN ames"
onChange="order ing(this.option s[this.selectedIn dex].value);">
<option value="Div1,Div 2">1 & 2</option>
<option value="Div3,Div 4">3 & 4</option>
<option value="Div1,Div 2,Div3,Div4" SELECTED>All Sections</option>
</SELECT>
<a href="#" onclick="setCoo kie('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 1600

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
2922
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 someone tell me why? function getVar($var="password") { // 05-08-03 - the important thing about this function is it reverses
4
2766
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 javascript code. Note that in the actual file, I've surrounded the variable '#cookie.cookiename#' with CFOUTPUT tags: document.write('<input type="Hidden" name="affiliate" value="#cookie.cookiename#">'); When I load the document in Netscape 7, I...
3
1222
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 = GetCookie('DemoName'); if (favorite > '1') { window.location.href = 'page2.htm'; }
2
2663
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 whether the vistor has the site's cookie present in their browser. If its not present, then to redirect user to a login page (script). If the cookie is present, then the rest of the html page should load. I'm able to get function to detect...
1
2046
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. (Similar to word jumbles or cryptograms.) I'm also keeping track of the user's complete guess in a cookie so they can save their game. I get the input; if it's a letter, I capitalize it and update the cookie; then move the focus to the next input...
4
6147
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 select menus called it. What can I do? function onCarrierSelect() {
10
8156
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 authenticated and login the system automatically base on the username and password already in the session. Is that possible to do ? and how to do it? Cheers Victor
4
2467
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 browser, but when trying to get the pages using WebRequest from my application I can only get the "you need to login page". I've then put a WebBrowser control in my application and do the login
2
1675
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 specific site. Also he has the option to check a checkbox "Remeber this choice" so that when he returns to the site it remembers what he has choosen from the drop down list and automatically takes him to a specific site. Here is my code:
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10090
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5380
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.