Hey Guys,
I am working on a bug causing a flickering input box. The page is dynamically created, and I noticed when you start typing in the empty box the text will be flickering as you type and when you delete the content of the box then whatever you type won't be displayed unless you go to different box and click back to the box and you will see the text.
I noticed when the page is created if I set the content to none empty( I tried <!-- -->) then the problem goes away. Basically, the textbox does not like to be empty!!!
Update1:
Browser Type: IE
The input box is part of a table and the content is filled with the following code:
function enableDesignMode(rte, html, readOnly)
{
var frameHtml
if (fnSetContent.html == null)fnSetContent.html = new Array();
fnSetContent.html[rte] = [html, readOnly];
if(html.length == 0 )
{
frameHtml = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
frameHtml += "<html id=\"" + rte + "\">\n";
frameHtml += "<html>\n<head>\n";
if (cssFile.length > 0)
{
frameHtml += "<link media=\"all\" type=\"text/css\" href=\"" + cssFile + "\" rel=\"stylesheet\">\n";
}
else
{
frameHtml += "<style>\n";
frameHtml += "body {\n";
frameHtml += " background: #FFFFFF;\n";
frameHtml += " margin: 0px;\n";
frameHtml += " padding: 0px;\n";
frameHtml += " font-family: Tahoma, Verdana, Arial;\n";
frameHtml += " font-size: 80%;\n";
frameHtml += "}\n";
frameHtml += "</style>\n";
}
frameHtml += "</head>\n";
frameHtml += "<body>\n";
frameHtml += html + "\n";
frameHtml += "</body>\n";
frameHtml += "</html>";
}
else
frameHtml = html;
if (document.all)
{
if (fnSetContent.html != null)
{
fnSetContent.html[rte][0] = frameHtml;
fnSetContent.html[rte][1] = readOnly;
}
var oRTE = frames[rte].document;
if (frames[rte].ready)
{
oRTE.open();
oRTE.write(frameHtml);
oRTE.close();
}
rteCommand(rte, "fontsize", "2");
oRTE.onselectionchange = new Function("updateFont('" + rte + "');");
oRTE.onkeyup = new Function("handleFont('" + rte + "');");
if(frameHtml.indexOf("STYLE") == -1)
{
setTimeout("setEditorStyles('" + rte + "');", 10);
}
}
else
{
...
then some other work is done
}
...
where the 'html' is the content of the input box...when it is empty the if part get executed which causes the flickering problem!!!
update2:
*** I noticed in one of the pages, removing
DTD will fix the issue, but then the text box shows
undefined.(update)getting undefined was my fault, and not the result of removing DTD, so never mind this...
update3:
Removing the url part will fix flickering issue and the text box does not get initialized with
undefined
Now, I am wondering what will be consequences if one omits the url field in a doctype tag?
original:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
modified:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">