471,893 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Problem comparing string variable: if statement not working

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; 
  3.          if  (DDC=="DDC")
  4.              {
  5.               radalert (DDC); 
  6.              }
May 7 '09 #1
6 5808
Can u start your own thread please mate
May 7 '09 #2
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
Yes, this how a go about it.
var DDC=document.getElementById("<%= hvalue.ClientID %>").value;
and the popup display DDC
pls help.
May 8 '09 #4
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
now working.
May 8 '09 #6
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
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

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.