Error on website

imstac73
imstac73 used Ask the Experts™
on
I am getting an syntax error on my website; when I look at the code of where it says the error exists the specific line/character position doesn't exist.  

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; MS-RTC EA 2; MS-RTC LM 8; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Fri, 23 Oct 2009 21:47:17 UTC


Message: Syntax error
Line: 72
Char: 17
Code: 0
URI: http://localhost:1285/timecard/members/timecard.aspx


Line 72, Character 17 would fall right after the "Else" in my code. 
 
<script language="javascript" type="text/javascript">
    function ValidateCostCode(source,arguments)
 {
 
                if ((
                    document.getElementById("<%=jobno.ClientID%>").value == ""
                ) && (
                    document.getElementById("<%=DD_CostCode.ClientID %>").selectedIndex = 0
                ))
                {
                    arguments.IsValid = true                        
                }
                else
              {
                  arguments.IsValid = false;
                    document.getElementById("<%=DD_CostCode.ClientID%>").focus();
                } 
 
            }
</script>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
End If?

Author

Commented:
'End if' where?  I have several other javascript functions that don't have End if and I'm not getting errors on these.
There's no end if in javascript.  Can you post the entire output page?  Some times with dynamic output, the error console can be thrown off a bit.  

The only error I see there is that you used a literal "=" where you should have used a conditional "==" in the second condition of your IF on line 10 above.  But normally that doesn't return a syntax error, it only tries to set the object to that value.  Anyway let's see the source of the output. (try to change any sensitive info). Just make sure it's the output and not the ASPX.  This could make a significant difference, and besides, its the part your browser sees, which is giving the error.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Michel PlungjanIT Expert
Top Expert 2009

Commented:
arguments is a reserved word by the way
@mplungjan (http:#25651225)

I think "arguments.isValid=false" is like "return false".........I think.
Michel PlungjanIT Expert
Top Expert 2009

Commented:
Not where I come from
hi mplungian: the code uses .net custom validator.
but
arguments.isValid=false   is to make the validation fail


@imstac73:

well i could not locate any errors in the syntax; but in the if condition
you code
document.getElementById("<%=DD_CostCode.ClientID %>").selectedIndex = 0

change it to

document.getElementById("<%=DD_CostCode.ClientID %>").selectedIndex == 0

also the line 72 may not be from your aspx page but from the output html page.
check the view source
Lol those are all things I already said fyi

Author

Commented:
Doesn't "==" mean not equal to?
"a==b" checks to see if the condition a is equal to b is true.  "a=b" sets a to b.

Author

Commented:
What do you use not equal?  <>?
For not equal, we use "!="

Author

Commented:
Turns out there was a problem with some other code...not the one listed.  Weird.  When you have a chance if you can look at my other question that would be great.  It is also related to javascript.  Thanks for your help.
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Studio_.NET_2005/Q_24755758.html
 

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial