473,387 Members | 1,493 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.

Problem comparing string variable: if statement not working

3
Hi
I am a problem comparing DDC AND "DDC" , the if statement is not working.
here is my javascript code

Expand|Select|Wrap|Line Numbers
  1. var DDC=document.getElementById("<%= hvalue.ClientID %>").value; 
  2.  
  3.          if  (DDC=="DDC")
  4.              {
  5.               radalert (DDC); 
  6.              }
Thanks
May 7 '09 #1
6 5913
DaiOz
16
Can u start your own thread please mate
May 7 '09 #2
acoder
16,027 Expert Mod 8TB
Quite right. I've split this off into its own thread. Please do not hijack other members' threads.

Onto your problem: do you get any errors? Have you checked that the value is really "DDC"?
May 8 '09 #3
sabel
3
Yes, this how a go about it.
var DDC=document.getElementById("<%= hvalue.ClientID %>").value;
alert(ddc);
and the popup display DDC
pls help.
May 8 '09 #4
acoder
16,027 Expert Mod 8TB
Check that there's no spaces. If there's a space it won't show on the alert, but an exact comparison would fail.
May 8 '09 #5
sabel
3
Thanks
now working.
May 8 '09 #6
acoder
16,027 Expert Mod 8TB
That was easy, wasn't it? :)
May 8 '09 #7

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

Similar topics

6
by: DLP22192 | last post by:
I have the following single-line if statement that is evaluating true even though it shouldn't. I have never seen this before and I am concerned that this can happen in other areas of my code. ...
20
by: rhino | last post by:
This worked before October now it does not work. I think I know where the trouble is but I don't know how to fix it. function findVerse() { var d = new Date(); var str; if( (...
6
by: Doohan W. | last post by:
Hi, I'm now working with DB2, and I can't find out how to execute the contents of a string Statement, without using a Java/... procedure, only using SQL statements. I know that some SQBDs such...
1
by: Alex.Wisnoski | last post by:
I have a data entry form with a combo box to look up an entrant's name. If the name is already in the table then it pulls up the record and that part of the form works fine. If the name isn't in...
19
by: David zhu | last post by:
I've got different result when comparing two strings using "==" and string.Compare(). The two strings seems to have same value "1202002" in the quick watch, and both have the same length 7 which I...
4
by: SeNTry | last post by:
Hi Everyone, My first post here as I just begin to learn programming in general and python in particular. I have all the noobie confused questions, but as I work thru the tutorials I'm sure...
0
by: nigeljordan | last post by:
Hi I’m having problems with the following method… It works for the ‘@user’ bit (i.e. it takes in the user variable and works within the sql command). But the @column variable still is not...
1
by: nigeljordan | last post by:
Hi I’m having problems with the following method… It works for the ‘@user’ bit (i.e. it takes in the user variable and works within the sql command). But the @column variable still is not...
5
by: Manikandan | last post by:
Hi, I have a datatable with rows. When I used datatable.select with values it is working properly, But when I use the select with variables it is not working. I tried with putting '(single...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.