如何在空字体标签中添加字符串?就像在第二个字体标记中没有值一样,我只会插入一个<br />标记.我怎样才能做到这一点?
我有这个HTML代码:
<P ALIGN="LEFT">
<FONT FACE="Verdana" style="font-size:10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">
Welcome to jQuery Course
</FONT>
</P>
<P ALIGN="LEFT">
<FONT FACE="Verdana" style="font-size:10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">
</FONT>
</P>
<P ALIGN="LEFT">
<FONT FACE="Verdana" style="font-size:10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">
This is the jQuery Introduction content.
</FONT>
</P>
Run Code Online (Sandbox Code Playgroud)
我喜欢输出:
<P ALIGN="LEFT">
<FONT FACE="Verdana" style="font-size:10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">
Welcome to jQuery Course
</FONT>
</P>
<P ALIGN="LEFT">
<FONT FACE="Verdana" style="font-size:10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">
<br />
</FONT>
</P>
<P ALIGN="LEFT">
<FONT FACE="Verdana" style="font-size:10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">
This is the jQuery Introduction content.
</FONT>
</P>
Run Code Online (Sandbox Code Playgroud)
您不应该使用字体标记.
您可以
str_replace("></FONT>", ">$myinserttext</FONT>", $myhtml);
Run Code Online (Sandbox Code Playgroud)
用PHP或
$("font:empty").html("Sample Content");
Run Code Online (Sandbox Code Playgroud)
在jQuery中.