473,395 Members | 1,595 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,395 software developers and data experts.

focus on checkbox

Adi
I'm trying to do default focus on checkbox,its work fine but the
problem is that the user cannot know where is the focus (there isn't
visual sign and on the other hand if you press on the tab button there
is a visual sign).
Jul 23 '05 #1
1 4970
"Adi" <ad********@amdocs.com> wrote in message
news:d5**************************@posting.google.c om...
I'm trying to do default focus on checkbox,its work fine but the
problem is that the user cannot know where is the focus (there isn't
visual sign and on the other hand if you press on the tab button there
is a visual sign).


Here's one approach. Watch for word-wrap.

This changes the background color (to yellow) of the checkbox that has focus
for two seconds.

<html>
<head>
<title>boxfocus.htm</title>
<script type="text/javascript">
function boxfocus(j) {
var form = document.forms[0];
for (var i=0; i<form.elements.length; i++) {
if (form.elements[i].type == "checkbox") {
form.elements[i].style.backgroundColor = "";
if (form.elements[i].name == ("box"+j)) {
form.elements[i].style.backgroundColor = "yellow";
setTimeout("boxblurs(" + i + ")",2000);
}
}
}
}
function boxblurs(i) {
var form = document.forms[0];
form.elements[i].style.backgroundColor = "";
}
</script>
</head>
<body onload="document.forms[0].box1.focus()">
<form>
<input type="text" name="txt1">
<input type="checkbox" name="box1" onfocus="boxfocus(1)">
<input type="checkbox" name="box2" onfocus="boxfocus(2)">
<input type="checkbox" name="box3" onfocus="boxfocus(3)">
<input type="text" name="txt2">
</form>
</body>
</html>
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Czarina | last post by:
hi guys! here I am again, bugging you Here is where my page stands right now: http://www.gainesvillewebs.com/czar...h_results-2.htm The top 2 forms are working just fine, but the bottom one, with...
1
by: Anthony | last post by:
Hi, Is there a way to put focus on a form element of type radio or checkbox. It only seems to work on input of type text... Thanks in advance, Anthony
6
by: AFN | last post by:
I want to click a checkbox and have a 4 line (approx) paragraph appear beneath the checkbox, pushing the rest of the page down. And when unchecking the checkbox, the paragraph should disappear...
4
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
4
by: OpticTygre | last post by:
If I create a checkbox dynamically: Dim NewCheckBox as New Checkbox Then, I display that checkbox on a form, how can I cause the checkbox to lose focus after a user clicks on it? TIA, ...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
37
by: viki1967 | last post by:
Hi all. I have this simple form. I need if checkbox C_1 is selected: 1) field name="n_1" is required and accept only numbers; 2) field name="n_2" is required and accept only numbers; I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.