I have a form with only one element, and I automatically put the focus in that element. This is for a comment field which may already have something in it that may be edited, and the form is pre-filled if there is. How do I modify my script to put the focus at the end of the comment if there is existing data?
Probably something simple, but I'm new at this.
Here is the script:
<head>
<title>Edit Comments</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var isNav4, isIE4;
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
isNav4 = (navigator.appName == "Netscape"
? 1 : 0;
isIE4 = (navigator.appName.indexOf("Microsoft"
!= -1) ? 1 : 0;
}
function fitWindowSize() {
if (isNav4) {
window.innerWidth = document.layers[0].document.images[0].width;
window.innerHeight = document.layers[0].document.images[0].height;
}
if (isIE4) {
window.resizeTo(600,500);
}
document.MyForm.Comments.focus();
}
// End -->
</script>
</head>
<BODY ONLOAD="fitWindowSize()">
Thanks! Calista :-X
Jedi Knight,
Champion of the Force
Probably something simple, but I'm new at this.
Here is the script:
<head>
<title>Edit Comments</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var isNav4, isIE4;
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
isNav4 = (navigator.appName == "Netscape"
isIE4 = (navigator.appName.indexOf("Microsoft"
}
function fitWindowSize() {
if (isNav4) {
window.innerWidth = document.layers[0].document.images[0].width;
window.innerHeight = document.layers[0].document.images[0].height;
}
if (isIE4) {
window.resizeTo(600,500);
}
document.MyForm.Comments.focus();
}
// End -->
</script>
</head>
<BODY ONLOAD="fitWindowSize()">
Thanks! Calista :-X
Jedi Knight,
Champion of the Force