Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-17-2005, 12:43 PM   #1
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:


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


Last edited by opioid; 03-17-2005 at 12:44 PM.
Old 03-17-2005, 02:22 PM   #2
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. (=


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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:00 PM.

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