L
Lee
I have this function that doesn't work. I pass it the td element and
an id, and it makes an input field inside the td. That part workds.
What doesn't work is that I want to add an "onkeyup" on the input
field. Any help? Please??? I don't get any error on my javascript
console in firefox, and I am not seeing any errors in IE.
// makes an input field that submits itself using setCalendarValue()
when it's blurred (it will be blurred if [enter] is pressed)
function makeCalendarInputField(el,hoursId,which){
var id=el.id;
// if this input field is already active, then don't let it be
activated again
if(thisCalendarInputField==id){
return false;
}
else{
thisCalendarInputField=id;
}
var value = el.innerHTML;
// remember the original value just in case
originalValue=value;
el.innerHTML='';
var inputField = "<input type='text' value='" + value + "'
name='inputField' id='inputField' "
+ " onBlur='setCalendarValue(this,\"" + id + "\");'
class='calendarInputField' />"
+ "<input type='hidden' name='" + whichField + "' id='" +
whichField + "' value='" + which + "' />"
+ "<input type='hidden' name='" + hoursIdField + "' id='" +
hoursIdField + "' value='" + hoursId + "' />"
+ "";
// change the innerHTML of this td into this input field
el.innerHTML = inputField;
document.getElementById('inputField').focus();
el.onKeyUp="alert('hi')";
return;
}
an id, and it makes an input field inside the td. That part workds.
What doesn't work is that I want to add an "onkeyup" on the input
field. Any help? Please??? I don't get any error on my javascript
console in firefox, and I am not seeing any errors in IE.
// makes an input field that submits itself using setCalendarValue()
when it's blurred (it will be blurred if [enter] is pressed)
function makeCalendarInputField(el,hoursId,which){
var id=el.id;
// if this input field is already active, then don't let it be
activated again
if(thisCalendarInputField==id){
return false;
}
else{
thisCalendarInputField=id;
}
var value = el.innerHTML;
// remember the original value just in case
originalValue=value;
el.innerHTML='';
var inputField = "<input type='text' value='" + value + "'
name='inputField' id='inputField' "
+ " onBlur='setCalendarValue(this,\"" + id + "\");'
class='calendarInputField' />"
+ "<input type='hidden' name='" + whichField + "' id='" +
whichField + "' value='" + which + "' />"
+ "<input type='hidden' name='" + hoursIdField + "' id='" +
hoursIdField + "' value='" + hoursId + "' />"
+ "";
// change the innerHTML of this td into this input field
el.innerHTML = inputField;
document.getElementById('inputField').focus();
el.onKeyUp="alert('hi')";
return;
}