LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-17-2005, 12:43 PM   #1
opioid
Member
 
Registered: Jul 2003
Location: Chicago
Distribution: Ubuntu
Posts: 124

Rep: Reputation: 15
for loop inside select box


Whatup LQ, I have a pretty easy question for all you JS heads out there--

I'm getting a list of days of the week from MySQL DB inside a select box for an edit information page that involves an UPDATE; query, so the select looks like this:

01
02
03
04
05
06
{...}

How can I have it so that when the page loads up, the correct index value is selected in teh dropdown? For instance, if today is the 2nd of July, "02" is given the "selected" attribute...

Right now, I have it so that when I load up the page the correct and proper index only gets the selected attribute after I hit "refresh". In Firefox, that is.

basically i think it's something similar to onchange=location=this.options[this.selectedIndex].value;

but i'm sick of banging my head against teh wall tryin to figure it out. Any help is mucho appreciado, as always

Thanks,
O

Last edited by opioid; 03-17-2005 at 12:44 PM.
 
Old 03-17-2005, 02:22 PM   #2
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
The BODY HTML tag supports the javascript call onLoad. Simple call the option list fill function from there. That should solve the problem. (=
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Put Values In Select Box From Database In Jsp nimishabhatia Programming 1 07-20-2005 01:16 PM
Select Box, PHP agallant Programming 8 08-04-2004 01:15 PM
[suse kde3] mouse cannot select/click inside window ashley8 Linux - Hardware 0 09-25-2003 09:51 AM
a low noise box with amd inside? annehoog Linux - Hardware 8 06-29-2002 08:53 PM
a trojan inside my box? doris Linux - Security 3 06-12-2002 04:31 AM


All times are GMT -5. The time now is 10:37 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration