473,404 Members | 2,137 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,404 software developers and data experts.

Using focus() with "this" keyword

4
Hi,

Im my function I need to use focus() and select() based on the "this" keyword.

example:

[PHP]
onchange="validate(this)"

function validate(input) {
input.focus();
input.select();
}

[/PHP]

But for some reason above code doesn't work.
Could anybody help me with that?

Thank you,
goe
Oct 2 '06 #1
1 2151
<script>
function valid()
{
if(document.formname.fieldname.value=="")
{
alert("Show message here");
document.formname.fieldname.focus();
return false;
}
}

</script>
and call this function on click event, then this is focus on your field where you want.
Oct 6 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mark Broadbent | last post by:
hi guys, i am currently studying through my book and wonder if somebody could clear this up before i have to look at other sources. I have code which defines and creates an event object using a...
3
by: Matt Swift | last post by:
If source contains lots of this. statements, does this incur any kind of minor performance hit, I'd imagine it does as it's causing a check to be performed? Thanks
15
by: Ben | last post by:
Hey, Not sure if this is the right group to post this on, so sorry in advance if it isn't. I'm using the VS.NET 2005 beta, and am trying to fill one grid, based on what is selected in the...
4
by: Elad Gutman | last post by:
Hello, Something is quite puzzled to me in using the 'ref' keyword, probably due to some lack of basic understanding. Whenever I wanna change the parameter passed to a function I will use the...
0
by: RBM007 | last post by:
Hello, I have created webpages in the atlas standard. To help my users, I automaticaly focus to the first editable control which is in a GridView kind control. Every gridview is placed in a...
5
by: Nathan Sokalski | last post by:
I was trying to use a code sample from a book I bought (.NET Gotchas by O'Reilly, author = Venkat Subramaniam). The line of code I am trying to use is the following: Dim coll As New...
6
by: PencoOdStip | last post by:
Why using the new keyword at all for memory allocation? I mean,why not let c++ find memory for you variable automatically? so insted of : int proba; proba = new int; why not just :
5
by: baskarpr | last post by:
Could somebody help me ? I have a left frame and right frame in a page. There is a form in right frame which has number of text box, checkbox, radio button, some static text's. For every input item...
4
by: KleberUK | last post by:
Good afternoon, I've been batling with this for a very long time. I would like to be able to use the Me keyword in a module. I spent hours and days trying to find a solution for this. There might...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.