Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple syntax issue

Status
Not open for further replies.

onressy

Programmer
Joined
Mar 7, 2006
Messages
421
Location
CA
<!--wsbr13_25--> is a value produced by the system from a hidden field

<script>
if(<!--wsbr13_25--> !==100)
{
alert("Each column must equal 100% \n \n The first column does not equal 100%");
history.go(-1);
}
</script>

Whats happening is that if wsbr13_25 is greater that 100 there is no alert, wanting to alert if wsbr13_25 is not 100,

any ideas?
 
'not familiar with !== ('not trying to be a smart-a**... I know there's an ===, so if you say there is a !==, I'll believe you!).

What happens if you just use != ?

Dave

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...east is east and west is west and if you take cranberries and stew them like applesauce
they taste much more like prunes than rhubarb does
[infinity]
 
Yes - remove the last equals sign.

Form fields have their values stored as strings, and as you are using the absolute equality test (=== / !==), you are testing for type as well as value equality.

So, effectively, you are comparing a number against a string, which will NEVER be absolutely equal, as they are different types.

Also, this:

Code:
if(<!--wsbr13_25-->

is unlike any server-side output I've ever seen. Are you sure that the value if put in place of the "<!--wsbr13_25-->" correctly? How about showing us the client-side source?

If that *is* the client-side source, then expect it to never work, because it's just not correct syntax for JavaScript.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top