日期:2014-05-16  浏览次数:20516 次

js输出的html代码在谷歌游览器的显示问题
JScript code

if(document.getElementById("showworkplanreminddiv"))
             {
                var str="";
                str+="<div width='30%' height='10%'>";
                str+="<table width='100%' height='100%' border='0'>";
                str+="<tr>";
                  str+="<td colspan='6'  style='background-image:url(publicimages/lcy_messageblue.png);'>&nbsp;</td>";
                str+="</tr>";
                str+="<tr>";
                 str+="<td width='87'>&nbsp;</td>";
                 str+="<td colspan='2' rowspan='4' align='left'><img src='publicimages/lcy_message.jpg'/></td>";
                str+="<td width='72'>&nbsp;</td>";
                str+="<td width='87'>&nbsp;</td>";
                str+="<td width='92'>&nbsp;</td>";
                   str+="</tr>";
                   str+="<tr>";
                str+="<td>&nbsp;</td>";
                str+="<td colspan='3' rowspan='2' align='center' ><strong>日程提醒!</strong></td>";
                str+="</tr>";
                str+="<tr>";
                str+="<td>&nbsp;</td>";
                str+="</tr>";
                str+="<tr>";
                str+="<td>&nbsp;</td>";
                str+="<td>&nbsp;</td>";
                str+="<td>&nbsp;</td>";
                str+="<td>&nbsp;</td>";
                str+="</tr>";
                str+="<tr>";
                str+="<td colspan='3' align='right' width='50%' height='10%' valign='middle'><a href='#'  onclick='lcy_remindtiaozhuan(\""+workplanid+"\")' title='打开'><img src='publicimages/lcy_open.jpg'   border='0'/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>";
                str+="<td colspan='3' align='left' width='50%' height='10%' valign='middle'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='#' title='关闭' onclick='closeremind()'><img src='publicimages/lcy_close.jpg' border='0'/></a></td>";
                str+="</tr>";
                str+="</table>";
                str+="</div>";//11:42    
                    
                $("#showworkplanreminddiv").css("display","");
                $("#showtoumingdiv").css("display","");
                document.getElementById("showworkplanreminddiv").innerHTML=str;
            }//if end



HTML code

<div id=\"showworkplanreminddiv\" name=\"showworkplanreminddiv\" style=\"display:none\"></div>



js输出的html代码在ie6和ie8上都好用,在谷歌游览器上却显示不出来,这是什么原因啊?请各位前辈们给看看





------解决方案--------------------
<div id=\"showworkplanreminddiv\" name=\"showworkplanreminddiv\" style=\"display:none\"></div>

你这个html又不是字符串,干嘛要转义 双引号