Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Client Side Scripting
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 07-24-2008, 10:24 AM
  #1
Vege
Novice
 
Vege's Avatar
 
Join Date: Sep 2004
Location: Finland
Posts: 2,708
iTrader: (0)
Vege will become famous soon enoughVege will become famous soon enough
deselecting text when moving with tabulator

Heya

I got a form with meny text inputs with prefilled values.
I'm looking for a way to deselect the text that is by default selected when using tabulator atleast in firefox.

The tabbing is giving me hard time, basically i can make some key -specific code, but souldn't it be just onfocus event?


Finding something with google at the topic is kinda hard.
__________________

i hate you
Vege is online now   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-24-2008, 09:33 PM
  #2
rangana
"Resolved" advocate
 
rangana's Avatar
 
Join Date: Jan 2008
Location: Cebu City Philippines
Posts: 2,030
iTrader: (1)
rangana has a spectacular aura aboutrangana has a spectacular aura about
I'm not certain on your goal, but have you tried to set the focus on any element (body) rather than the textbox
rangana is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2008, 09:43 AM
  #3
Vege
Novice
 
Vege's Avatar
 
Join Date: Sep 2004
Location: Finland
Posts: 2,708
iTrader: (0)
Vege will become famous soon enoughVege will become famous soon enough
Quote:
<html>
<head>

</head>
<body>
<form>
1: <input type="text" name="" value="some text1" /><br />
2: <input type="text" name="" value="some text2" /><br />
3: <input type="text" name="" value="some text3" /><br />
4: <input type="text" name="" value="some text4" /><br />
5: <input type="text" name="" value="some text5" /><br />
</form>


</body>
</html>
When i select first input element and press tabulator to move to next one, the text in next field is selected by default. How can i stop that?
Everything else should remain the same.
__________________

i hate you
Vege is online now   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2008, 09:23 PM
  #4
rangana
"Resolved" advocate
 
rangana's Avatar
 
Join Date: Jan 2008
Location: Cebu City Philippines
Posts: 2,030
iTrader: (1)
rangana has a spectacular aura aboutrangana has a spectacular aura about
You can try this:
Code:
<script type="text/javascript">
window.onload=function(){
for(var i=0,inp=document.forms[0].getElementsByTagName('input');i<inp.length;i++)
	{
	inp[i].onfocus=function()
		{
		if (document.selection)
		document.selection.empty();
		else if (window.getSelection)
		window.getSelection().removeAllRanges();}
	}
}
</script>
Or alternatively, you can replace highlighted with:
Code:
var temp=this.value;this.value='';this.value=temp;
Hope that helps.
rangana is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-25-2008, 03:35 AM
  #5
Vege
Novice
 
Vege's Avatar
 
Join Date: Sep 2004
Location: Finland
Posts: 2,708
iTrader: (0)
Vege will become famous soon enoughVege will become famous soon enough
As this has come important again i gave it another go with your suggestions and could not get this to work. Seems that this is an Firefox accessibility functionality that i need to turn off from firefox settings. But as i can't do that to n+1 clients i'm again looking for javascript solution.
I'm wondering would "reprogramming" the tabulator key work on this issue. I might give it a try.
__________________

i hate you
Vege is online now   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-02-2008, 06:12 AM
  #6
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 1,610
iTrader: (0)
¥åßßå is a jewel in the rough¥åßßå is a jewel in the rough¥åßßå is a jewel in the rough
HTML Code:
<html>
<head>

</head>
<body>
<form>
1: <input type="text" name="" value="some text1" /><br />
2: <input type="text" name="" value="some text2" /><br />
3: <input type="text" name="" value="some text3" /><br />
4: <input type="text" name="" value="some text4" /><br />
5: <input type="text" name="" value="some text5" /><br />
</form>
<script type="text/javascript">
var inputs = document.getElementsByTagName( 'input' );

for( var i = 0; i < inputs.length; i++ )
{
	inputs[i].onfocus = function(){
			this.onkeyup = function(){
				this.selectionStart = this.selectionEnd;
				this.onkeyup = false;
			}
	}
}
</script>
</body>
</html>
¥

Comments on this post
Vege agrees: That did the trick (and i hate tricks)
__________________
I may have opened the door, but you entered of your own free will
Blogrums

Last edited by ¥åßßå : 09-02-2008 at 06:18 AM.
¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-02-2008, 05:27 PM
  #7
Vege
Novice
 
Vege's Avatar
 
Join Date: Sep 2004
Location: Finland
Posts: 2,708
iTrader: (0)
Vege will become famous soon enoughVege will become famous soon enough
Yup, still have to check for a crossbrowser method, but ill think i can pull it trough.
The thing i was missing was the onkeyup=false
__________________

i hate you
Vege is online now   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 06:23 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.