Dear Guys,
I have a question about Javascript because I am new in javascript my problem is how to get return true value in my code here my code
Code:
<script type="text/javascript" charset="UTF-8" language="javascript">
function numbersonly(myfield, e, dec)
{
var key;
var keychar;
if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);
if ((key==null) || (key==0) || (key==8) ||
(key==9) || (key==13) || (key==27) )
function returnnum(){
}
if (window.event)
key= window.event.keyCode;
document.element
else
return true;
else if ((("01").indexOf(keychar) > -1))
return true;
else if (dec && (keychar == "."))
{
myfield.form.elements[dec].focus();
return false;
}
else
return false;
}
function checkUncheckAll(theElement)
{
var theForm = theElement.form, z = 0;
for(z=0; z<theForm.length;z++)
{
if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
{
theForm[z].checked = theElement.checked;
}
}
}
function checkUncheckSome(controller,theElements)
{
var formElements = theElements.split(',');
var theController = document.getElementById(controller);
for(var z=0; z<formElements.length;z++)
{
theItem = document.getElementById(formElements[z]);
if(theItem.type)
{
if (theItem.type=='checkbox')
{
theItem.checked=theController.checked;
}
} else {
theInputs = theItem.getElementsByTagName('input');
for(var y=0; y<theInputs.length; y++)
{
if(theInputs[y].type == 'checkbox' && theInputs[y].id != theController.id)
{
theInputs[y].checked = theController.checked;
}
}
}
}
}
</script>
because my main purpose is to disable other number only 1 and 0 will input if you enter 1 only 1 no other number in one text attach here is my screen shot in the primary is different input box if you enter 1 only and in the second if you enter 0 only will appear do you have idea.
Thanks
Bookmarks