Current location: Hot Scripts Forums » General Web Coding » JavaScript » <Select> selected value equal to external file


<Select> selected value equal to external file

Reply
  #1 (permalink)  
Old 05-19-04, 10:31 AM
fs22 fs22 is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
<Select> selected value equal to external file

Has anyone ever set the initially selected value of a select menu equal to a value in an external file like a cookie or something? So basically making the initial value selected dynamic in nature.
Reply With Quote
  #2 (permalink)  
Old 05-19-04, 12:24 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
All you need to do is to set the .selectedIndex property to a variable and change that variable dynamically to whatever you want like this (simplified):

myCookie=parseInt(document.cookie)

document.getElementById('mySelectBox').selectedInd ex = myCookie

This of course has to be done after the selectbox has been rendered on the page otherwise you'll end up with a reference error...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
global variables in external file Dr-Leech JavaScript 1 05-15-04 02:28 PM
Getting the created file (fopen/fwrite) Programme PHP 5 02-14-04 03:09 PM
Tar Backup of selected file extension dhiru The Lounge 0 12-26-03 06:12 AM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 04:28 PM
Upload file type and size limiter! Arctic ASP 1 08-02-03 07:06 PM


All times are GMT -5. The time now is 02:20 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.