onblur doesn't work... HELP

B

bobo

hello,
I have a script like this

<script language="JavaScript" type="text/javascript">
function cekiraj_vrijeme(ova){
alert("radi");
if (vrijeme.value<25 AND vrijeme.value>-1){
alert("vrijeme je ok");
}else {
alert("vrijem nije ok");
}
return true;
}
</script>

<?php
echo "<form action='$PHP_SELF' method='POST' onsubmit=\"return
checkform(this);\">
<label>Pon: </label>&nbsp;<input type='text' name='pon_od' size='3'
onblur=\"cekiraj_vrijeme(this)\" >&nbsp;-&nbsp;<input type='text'
name='pon_do' size='3' onblur=\"cekiraj_vrijeme(this)\" /><br />
<input type='submit' name='k' value='Unesi' />
</form>";
?>


and, I realize that probably the validation won't work... but I'll work
that out... what's troubling me is that onblur won't work...
Any help is appriciated,
thanks
--
 
V

VK

hello,
I have a script like this

<script language="JavaScript" type="text/javascript">
function cekiraj_vrijeme(ova){
alert("radi");
if (vrijeme.value<25 AND vrijeme.value>-1){

It is not Javascript, in Javascript boolean AND operand is &&
if (vrijeme.value<25 && vrijeme.value>-1)
 
B

bobo

Randy said:
bobo said the following on 1/19/2008 1:16 PM:

AND is not AND in JS. && is AND.

The syntax error is what is causing your problem.

And, in the future, don't post your server side code, post the code
the browser gets.

Also, look at the group FAQ to find out why vrijeme isn't going to
work in non-IE browsers.

ok... thanks... can you give me the address of the faq, so I could read
it...and... for the script not working in non ie browsers... I'm using
firefox and the code works fine...

--
 
B

Bart Lateur

bobo said:
I have a script like this

<script language="JavaScript" type="text/javascript">
function cekiraj_vrijeme(ova){
alert("radi");
if (vrijeme.value<25 AND vrijeme.value>-1){
alert("vrijeme je ok");
}else {
alert("vrijem nije ok");
}
return true;
}
</script>

I see you refer to a variable "vrijeme"
<?php
echo "<form action='$PHP_SELF' method='POST' onsubmit=\"return
checkform(this);\">
<label>Pon: </label>&nbsp;<input type='text' name='pon_od' size='3'
onblur=\"cekiraj_vrijeme(this)\" >&nbsp;-&nbsp;<input type='text'
name='pon_do' size='3' onblur=\"cekiraj_vrijeme(this)\" /><br />
<input type='submit' name='k' value='Unesi' />
</form>";
?>

But I don't see where it comes from.

Also, you use a parameter "ova" referring to the input widget that just
lost the focus ("this"), but you don't use it.
 
B

bobo

In reply to Randy Webb:

thx for the link...
about the function... I've asked just why onblur effect isn't
working... I was going to change the function after I work out why the
effect wasn't working... but... when I changed AND into &&... it was
working... so.. then I changed the function to fit my needs... so... it
was working like I needed it when I changed the logical operator....

Regards



--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top