469,276 Members | 1,488 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

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 5706
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

Post your reply

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

Similar topics

6 posts views Thread by DLP22192 | last post: by
20 posts views Thread by rhino | last post: by
1 post views Thread by Alex.Wisnoski | last post: by
19 posts views Thread by David zhu | last post: by
4 posts views Thread by SeNTry | last post: by
5 posts views Thread by Manikandan | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.