Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
code work in ie but not in ff
Old 08-17-2007, 12:32 AM code work in ie but not in ff
Skilled Talker

Posts: 70
Name: rex
Trades: 0
i just want to ask why this set of functions doesnt work in ff but perfectly works in ie:

document.myform.fname.focus();
document.myform.fname.select();
shotokan99 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-17-2007, 01:05 AM Re: code work in ie but not in ff
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
It does work in Firefox, actually. Here's an example:

http://www.dynamicdrive.com/style/cs...css-tabs-menu/

You've probably got some error in your code somewhere. Where's the page you're working on?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 08-17-2007, 01:28 AM Re: code work in ie but not in ff
Skilled Talker

Posts: 70
Name: rex
Trades: 0
actually this is my code of doing it:
function chkfname(n){
fn=n.value;
if(fn.length !=0){
if(isNaN(fn)==false){
alert('Only alpha chars are allowed...');
document.myform.fname.focus();
document.myform.fname.select();
}else{
if(fn.length >15){ // check the number of chars...
s=fn.slice(1,15);
document.myform.fname.value=s;
alert('allowed char is only 15');
document.myform.lname.focus();
}
}
}
}


...on ie, upon click ok on the alert it will go to fname txtbox. however if i use ff, it will go to the next. is there any problem with my code?
shotokan99 is offline
Reply With Quote
View Public Profile
 
Old 08-17-2007, 11:19 AM Re: code work in ie but not in ff
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Quote:
Originally Posted by shotokan99 View Post
...on ie, upon click ok on the alert it will go to fname txtbox. however if i use ff, it will go to the next. is there any problem with my code?
This is deliberate behaviour to prevent mis-operation.
If this function is triggered by an onblur handler, clicking the OK will refocus the input, which will them immediately lose focus because the button is still down. This can cause endless loops.

Avoid the combination alerting on blur and refocusing the input.
logic ali is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to code work in ie but not in ff
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49581 seconds with 12 queries