S
Scott Navarre
Hello,
I have noticed that when using JavaScript to create a page, the sizes of
the text input form elements come out bigger than the size I am trying to
set them to. I don't know if it matters, but I am using IE6...
For example: if I create a text input with a size of "1" using straight
HTML, and then type into it, I can see 2 characters at a time. But when I
use JavaScript's 'document.write()' function to create the same text input,
it is noticeably bigger and when I type into it I can see 5 characters at a
time.
Here is a short, simple example to illustrate the problem:
<HTML>
<HEAD>
<TITLE>JavaScript Test</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function createPage()
{
var page='';
page+='<HTML>';
page+='<TITLE>JavaScript Test</TITLE>';
page+='<BODY>';
page+='<FORM>';
page+='Text Input (Size="1"): <INPUT TYPE="TEXT" SIZE="1">';
page+='</FORM>';
page+='</BODY>';
page+='</HTML>';
document.write(page);
document.close();
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
Text Input (Size="1"): <INPUT TYPE="TEXT" SIZE="1">
<BR><BR><BR>
<INPUT TYPE="BUTTON" VALUE="Re-render this page using JavaScript"
onClick="createPage()">
</FORM>
</BODY>
</HTML>
Am I missing something (doing something wrong)? Or is there anything that
can be done to fix this problem?
Thanks in advance,
Scott Navarre
I have noticed that when using JavaScript to create a page, the sizes of
the text input form elements come out bigger than the size I am trying to
set them to. I don't know if it matters, but I am using IE6...
For example: if I create a text input with a size of "1" using straight
HTML, and then type into it, I can see 2 characters at a time. But when I
use JavaScript's 'document.write()' function to create the same text input,
it is noticeably bigger and when I type into it I can see 5 characters at a
time.
Here is a short, simple example to illustrate the problem:
<HTML>
<HEAD>
<TITLE>JavaScript Test</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function createPage()
{
var page='';
page+='<HTML>';
page+='<TITLE>JavaScript Test</TITLE>';
page+='<BODY>';
page+='<FORM>';
page+='Text Input (Size="1"): <INPUT TYPE="TEXT" SIZE="1">';
page+='</FORM>';
page+='</BODY>';
page+='</HTML>';
document.write(page);
document.close();
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
Text Input (Size="1"): <INPUT TYPE="TEXT" SIZE="1">
<BR><BR><BR>
<INPUT TYPE="BUTTON" VALUE="Re-render this page using JavaScript"
onClick="createPage()">
</FORM>
</BODY>
</HTML>
Am I missing something (doing something wrong)? Or is there anything that
can be done to fix this problem?
Thanks in advance,
Scott Navarre