By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,165 Members | 853 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,165 IT Pros & Developers. It's quick & easy.

onblur doesn't work... HELP

P: n/a
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
--

Jan 19 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
bobo said the following on 1/19/2008 1:16 PM:
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){
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 19 '08 #2

P: n/a
VK
On Jan 19, 9:16 pm, "bobo" <fourtwent...@yahoo.comwrote:
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)

Jan 19 '08 #3

P: n/a
Randy Webb wrote:
bobo said the following on 1/19/2008 1:16 PM:
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){

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...

--

Jan 19 '08 #4

P: n/a
bobo said the following on 1/19/2008 2:41 PM:
Randy Webb wrote:
>bobo said the following on 1/19/2008 1:16 PM:
>>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){
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...
Firefox is making an ID/NAME attribute a global variable? You pass in
"this" as a reference but you never use it in your function.

The group FAQ is in my signature, but, here it is again:
comp.lang.javascript FAQ - <URL: http://jibbering.com/faq/index.html>

The specific entry I was referring to is 4.41: <URL:
http://jibbering.com/faq/index.html#FAQ4_41>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 19 '08 #5

P: n/a
bobo wrote:
>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.
--
Bart.
Jan 20 '08 #6

P: n/a
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

--

Jan 21 '08 #7

P: n/a
bobo said the following on 1/21/2008 9:29 AM:
In reply to Randy Webb:

thx for the link...
Thank you for quoting next time :)
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....
The reason it wasn't working is because there was an error in the code.
So, the function never got defined. What you should have gotten was an
error message along the lines of "Object expected" (IE) or
"cekiraj_vrijeme is undefined" (FF) type error message which is because
the function wasn't being defined.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 21 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.