473,385 Members | 1,343 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,385 software developers and data experts.

If statement: != does not work

Hello,

Can someone help me.
'number' is a string and not a number!
Why does the following not work:

<script type='text/javascript'>

function calculate(rij) {

var number = "0";

if(number!="0") {
for(var i=0; i<description.length; i++) {
if(description[i] == descr) {
var arrrow=i;
}
}
)
}
</script>

I also tried:
if(number>"0") {

But because number is a string, that did not help much (you have to
try sometimes a few things).
The above source-code is part of a PHP-script (I replace the \" in "),
but that should not matter.
When the PHP-code has been started, I see an error in my IE at the
left bottom of the window (Error on page / Done). When I run the above
script only, I do not get an error. But when I add a line
alert("test"); before </script>, I do not see the alert, that alerts
me that there is an error.

I hope you have enough information to see what i did wrong.

Thank you in advance!
Mar 12 '08 #1
4 1791
wrote on 12 mrt 2008 in comp.lang.javascript:
Why does the following not work:

<script type='text/javascript'>

function calculate(rij) {

var number = "0";

if(number!="0") {
for(var i=0; i<description.length; i++) {
if(description[i] == descr) {
var arrrow=i;
}
}
)
The ) must be a }

Please do not just say "does not work",
but state the error line and code.

}
</script>
The above source-code is part of a PHP-script
It is not, it is plain clientside javascript.
(I replace the \" in "),
??
but that should not matter.
When the PHP-code has been started,
The PHP code, should have been finished by then,
because that runs on the server and just manipulates
the html stream sent to the client.

So please look at and perhaps send us [part of] the view source code
that the browser received. The code as submitted to the PHP engine on the
browser is not of interest to us in this NG, and your error is
clientside.
I see an error in my IE at the
left bottom of the window (Error on page / Done).
What browser?

If it is IE you shoud double click the error icon to read the error
When I run the above
script only, I do not get an error.
Compare both view source codes.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 12 '08 #2
On Mar 12, 1:52 pm, weblinkunlimi...@gmail.com wrote:
Hello,

Can someone help me.
'number' is a string and not a number!
Why does the following not work:

<script type='text/javascript'>

function calculate(rij) {

var number = "0";

if(number!="0") {
for(var i=0; i<description.length; i++) {
if(description[i] == descr) {
var arrrow=i;
}
}
)
}
</script>

I also tried:
if(number>"0") {

But because number is a string, that did not help much (you have to
try sometimes a few things).
The above source-code is part of a PHP-script (I replace the \" in "),
but that should not matter.
When the PHP-code has been started, I see an error in my IE at the
left bottom of the window (Error on page / Done). When I run the above
script only, I do not get an error. But when I add a line
alert("test"); before </script>, I do not see the alert, that alerts
me that there is an error.

I hope you have enough information to see what i did wrong.

Thank you in advance!
I'll give you a hint, run the code in Firefox and look at the
javascript error log. That will help you find the error.
Mar 12 '08 #3
Ervertjan,
The ) must be a }
Thank you for the second time!!!

With your help with my previous question, everything works very
well!!!

Ramin
Mar 12 '08 #4
On Mar 13, 6:52 am, weblinkunlimi...@gmail.com wrote:
Hello,

Can someone help me.
'number' is a string and not a number!
Why does the following not work:

<script type='text/javascript'>

function calculate(rij) {

var number = "0";

if(number!="0") {
It seems to me that will always return false and the block statement
will never be executed.
--
Rob
Mar 13 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
by: Andrey Tatarinov | last post by:
Hi. It would be great to be able to reverse usage/definition parts in haskell-way with "where" keyword. Since Python 3 would miss lambda, that would be extremly useful for creating readable...
11
by: brainsucker | last post by:
Hi My name is Juan Carlos Rodrigo, and I love Python. It is the most impressive and usefull language that I have ever seen. I am studing, at http://www.uoc.edu, an Information Technology...
4
by: Tom Walker | last post by:
I cannot get the WHERE statement to work correctly unless I use a literal with the LIKE. I want to use a working storage data name so that I can vary the WHERE statement. Example that works: ...
2
by: JS | last post by:
I have v8.1 fix5 using Win2k AS on 7 node logical system. I create event monitor writing to file and turn it on. Using application, I connect to db and navigate from screen to screen, generating...
9
by: Peter | last post by:
My problem is the last bit of coding below, the like statement does not work. what I have is a product options field and in it is stored characters i.e. "avcy" etc what the query does is...
5
by: Arthur Mnev | last post by:
This is probably beaten to death subject... Does anyone have a good idea of what penalties are for using Fixed statement in c#. On one side it allows for much greater flexibility with casts and...
35
by: Thierry Loiseau | last post by:
Hello all, and Happy end year 2005 ! Well, I would like to obtain a list of all JavaScript var statement, With "for...in" perharps ? That is bellow my recent test here, but the problem is...
13
by: eman1000 | last post by:
I was recently looking at the prototype library (http://prototype.conio.net/) and I noticed the author used the following syntax: Object.extend(MyObj.prototype, { my_meth1: function(){},...
28
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions!...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.