Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determne whether the insert is on?

Status
Not open for further replies.

790213

Programmer
Sep 22, 2003
50
0
0
ZA
I want to determine whether the insert button has been set to be active. How can I do this?
 
By active do you mean not disabled? If so try something like this:
Code:
if (formName.buttonName.disabled) {
   alert('Button disabled');
}
else {
   alert('Button enabled');
}

-kaht

banghead.gif
 
That's if you want to check if the button on a form is disabled. What I'm actually looking for is how to determine whether the Keyboard insert is on or of. I need to somehow check the active events list if such a thing exists. Do you know how to do this?
 
Not sure how to tell whether it is "active", but you can tell when it has been pressed by capturing the onkeypress event - it will have a value of 45.

Try:
Code:
<script language=&quot;JavaScript&quot;>
<!--
if (navigator.appName == 'Netscape'){ 
	document.captureEvents(Event.KEYPRESS); 
} else if (navigator.appName == 'Microsoft Internet Explorer'){
	document.onkeydown = InternetExplore;	//NO &quot;()&quot;
} else {
	document.onkeypress = OtherBrowsers;	//NO &quot;()&quot;
}
function InternetExplore(e) {	//Remember the (e)
	document.keyform.keynumber.value = window.event.keyCode;
	document.keyform.keystring.value = &quot;[ &quot; + String.fromCharCode(window.event.keyCode) + &quot; ]&quot;;
}
function OtherBrowsers(e) {		//Remember the (e)
	document.keyform.keynumber.value = e.which;
	document.keyform.keystring.value = &quot;[ &quot; + String.fromCharCode(e.which) + &quot; ]&quot;;
}
//-->
</script>
<form name=&quot;keyform&quot;>
Number:<br>
<input type=text size=10 name=&quot;keynumber&quot; value=&quot;&quot;>
<br> <br>
String:<br>
<input type=text size=10 name=&quot;keystring&quot; value=&quot;&quot;>
</form>

On focus of a particular field you could start capturing the keystroke, and then on blur of the field stop. What are you trying to do?

Pete.


Lotus Notes Web Developer / Aptrix (LWWCM) Consultant
w: e: Pete.Raleigh(at)lclimited.co.uk
 
This is a really tough one, but I'll figure something out. There must be way to get a list of all active events, how I don't know... YET ;)

Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top