473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

What am I overlooking? Totally stumped!

Expand|Select|Wrap|Line Numbers
  1. var s = document.getElementById('field[12]');
  2. var cust_cc_exp_month = s.options[s.selectedIndex].value;
  3.  
  4. // This displays the correct Value -- which is "0" for item #0 = "Please select..."
  5. alert("Month: " + cust_cc_exp_month.toString());
  6.  
  7. if (cust_cc_exp_month == "0") {
  8. // This code never executes!
  9. }
  10.  
  11. Here is the HTML portion:
  12.         <select id="field[12]" name="field[12]">
  13.         <option value="0">Select a Month...</option>
  14.         <option value="1" <?php if ($field[12] == "1") echo "SELECTED" ?>>January</option>
  15.         <option value="2" <?php if ($field[12] == "2") echo "SELECTED" ?>>February</option>
  16.         </select>
  17.  
I've tried using cust_cc_exp_month.toString(), and I've tried == 0 instead of == "0".
Nothing seems to work. To me, it defies all logic! There has to be something I'm overlooking.

Thanks for any help you can provide --

Matthew
Feb 28 '08 #1
2 899
hsriat
1,654 Expert 1GB
Try using id as field_12 instead of field[12] or give value="x" instead of 0.

Just a guess!
Feb 28 '08 #2
Markus
6,050 Expert 4TB
Try using id as field_12 instead of field[12] or give value="x" instead of 0.

Just a guess!
I believe id attributes can only be numbers, letters, underscores and hypens?
Feb 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
35
by: wilsonidv | last post by:
Daer All: I have studied C language for just 2~3 months. I'd like to know the critical parts of C, focusing on these. Could anyone has many experiences tell me, please. Thanks and Regards.
6
by: Damien Sawyer | last post by:
Hello - I'm having a serious problem with IIS on Windows XP pro. Whenever I try to run ASP pages, I get HTTP 500 - Internal server error This behaviour happens identically, on two 'totally...
1
by: Chris Simmons | last post by:
Hello: I am trying to better understand the HttpResponse.Filter property and, although I think I "get it," I am wondering what is going on behind the scenes. I was initially stumped with the...
5
by: Alan Silver | last post by:
Hello, Server configuration: Windows 2003 Server SP2 SQL Server 2000 SP4 ..NET v2.0.50727 just built up a new server using the same configuration as my current one. I even used the same CDs...
0
by: Sells, Fred | last post by:
I had some code originally that printed the sql and params when I called the .execute method. I removed it but it still prints. I rebooted and renamed files and still it prints. I am totally...
3
by: vozzek | last post by:
Hi all, I'm a CSS rookie, but I'm stumped. Hopefully this is something simple that I'm overlooking. My master/detail page generates the following html code, and I've got it formatted with CSS...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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
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
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,...

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.