File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes JS code not working. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "JS code not working." Watch "JS code not working." New topic
Author

JS code not working.

pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Hi,
Could you please tell me where exactly I have made mistakes as the following JS code is not working.



Thanks,
Pramod
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56183
    
  13

Without giving us any idea where the problem is happening? Or even what the problem is? Please put a little more effort into your post.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Hi Bear,

The code looks good to me, but neither the alert message nor the calculation part takes place if I run it.
Don't know what exactly went wrong.

Apologies for the inconvenience.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

I'm not an expert in this. Try by putting the semicolon inside the double quotes instead of it being outside like you have mentioned in your post onchange="calculatePrice()";


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Nope Joe.
No change.
Ogeh Ikem
Ranch Hand

Joined: May 13, 2002
Posts: 180
Your code contains numerous errors. I've spotted only two of them but I'm sure that there are more. For example, the following code

should be

Also, the following code

should be


Like Bear Bibeault said please put a little more effort into your post.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35239
    
    7
If you use Firefox, then the Error Console (to be found in the Tools menu) will be very valuable for tracking down JavaScript bugs.


Android appsImageJ pluginsJava web charts
pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Hello,

I've corrected the code and it works fine now.

The only problem I'm facing right now is that if I leave "Name" or "minutesPickup" field empty or invalid, I do get Alert box but then the pointer moves to the next field.
I need to show the pointer in the same field after clicking OK on my Alert box.
I tried changing "onblur" to "onchange" for "Name" field but it didn't work.

Below is the code :
Ogeh Ikem
Ranch Hand

Joined: May 13, 2002
Posts: 180
replace this code


with this
pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Thanks Ogeh Ikem
I tried out with both Name.focus() &document.getElementById("Name").focus();
Both ways, it works fine.
Ogeh Ikem
Ranch Hand

Joined: May 13, 2002
Posts: 180
You're welcome.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JS code not working.
 
Similar Threads
Setting currency problem.
XSLT problem with javaScript removeAttribute()
How can i trace this..
dynamic addition of numbers entered in textbox
i wanna add text field dynamically on onblur even how i can create textbox dynamicall