Unable to activate the control in IE6
I am quite surprised by the lack of solution on Google for my problem. I developed a calculator in php / jscript and inevitably it works on IE7 and Firefox 2 and so on, but 20% of Internet users are still on IE6. So I must also think about them.
So that's my problem:
Line 18
Error Unable to activate the control because it is either invisible or inactive
My question:
HTML Code:
<script type="text/javascript">
//<![ CDATA [
nbpages = 7; // number of tabs
function page (npage) {
list_tags = document.getElementById ("tabs").getElementsByTagName ("li");
for (i = 0; i < list_tags.length; i++) {
list_tags[i].className = "";
}
document.getElementById ( "tab" + npage). className = "active";
for (i = 1; i <= nbpages; i++) {
document.getElementById ("content" + i).className = "nonactive";
}
page_elt = document.getElementById ("content" + npage);
page_elt.className = "active";
if (page_elt.getElementsByTagName ("input") [0]! = null) {
page_elt.getElementsByTagName ("input") [0]. focus ();
page_elt.getElementsByTagName ("input") [0]. select ();
}
}
//]]>
</script>
Re: Unable to activate the control in IE6
I think let us see which triggered the error. Try to attach an event on an object which are not or can not receive this kind of method
Code:
if (page_elt.getElementsByTagName ("input") [0]) && window.XMLHttpRequest)
which should work equally well
Re: Unable to activate the control in IE6
When I place an alert (page_elt.getElementsByTagName ("input") [0]) before the condition, on IE6 I [Object] and on Firefox I [Object HTMLInputElement].
Otherwise, I have another little problem controlling my entry form (always with IE6 and then IE7, Firefox ok).
Code:
function validate (champtest) {
var number = document.getElementById (champtest). value;
if (!isNaN (number))
{
alert ( 'ok');
}
else
{
alert ( "The seizure is not a number!");
document.getElementById (champtest). value = 0;
}
return false;
}
Field tested example:
HTML Code:
<input name = "param2x15" id = "param2x15" value ="<?= variable ( "param2x15");?>" size = "8" onchange = "confirm ('param2x17') return false;"/>
symptom: on IE6, I can no longer go on another field, the alert comes whenever I go elsewhere, while it works in IE7 and Firefox.
Thank you again.
Re: Unable to activate the control in IE6
For the first part it means that the error is not the code that you have shown. Use a real debugger.
http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx
Just check whether is selected. If not then do check it and submit. You can also try with onkeypress.
Re: Unable to activate the control in IE6
Field tested:
HTML Code:
<input name = "param2x15" id = "param2x15" value ="<?= variable ( "param2x15");?>" size = "8" onchange = "confirm ('param2x15') return false;"/>
JavaScript:
Code:
function validate (champtest) {
var number = document.getElementById (champtest).value;
if (!isNaN (number))
{
document.getElementById (champtest).value = document.getElementById (champtest).value;
}
else
{
alert ("The seizure is not a number!");
document.getElementById (champtest).value = 0;
}
return false;
}
it works with all browsers except IE as I press the TAB to move to the next field. With onkeypress is worse, I can not write anything at all.
Re: Unable to activate the control in IE6
ok I misunderstood. You want to launch validation when you get out of the field and not when the changes
HTML Code:
<input type = "text" name = "param2x15" id = "param2x15" value ="<?= variable ("param2x15");?>" size = "8" onchange = "validate (this.value,this.id);"/>
Code:
function validate (val,id) {
if (isNaN (val)) {
alert ( "The seizure is not a number!");
document. getElementById (id). value = 0;
}
}