这些PHP代码,和JavaScript做某种结合后,网页不能正确显示的问题 当然不行!!!你把php的输出放在js脚本里,内容又不符合js语法。那怎么可以呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在 - 2 - 中修改: echo $newstype . "<br />\n"; 改为 echo "document.write(" . $newstype . ")";也不行 放在js脚本里的东西要符合js的语法 你还是先将文件 1 生成的代码是单独放到 <script language="JavaScript"> <script>中,检查代码是否符合JavaScript语法要求。 xuzuning(唠叨),能示范写一下吗? 试试echo mysql_error();换成echo "document.write(".mysql_error().");"; echo $newstype . "<br />\n"; 改为 echo "document.write(" . addslashes(str_replace("\r\n",'\r\n',$newstype)) . ")"; 不好意思echo "document.write(" . addslashes(str_replace("\r\n",'\r\n',$newstype)) . ")";换成echo "document.write(" . str_replace("\r\n",'\r\n',addslashes($str)) . ")"; u cannot write php codes in js codes,u should use php to echo the whole js function. like:<?php echo "<script language=\"javascript\">"; echo "alert(\"success!\");"; echo "</script>";?> 每周定时调用代码,这个功能该怎么写呢? 急!apache与php关联配置!查过百度大神 但无用 关于php 生成静态页,标签问题 求指点 问一个数组的弱弱问题 大甩分了,不够再加~ 为什么我的php用不了setcookie iis+php4.06+2000 请教imap的问题 如何使session注銷失效? 如何在fclose之前把fwrite的内容刷新到文件中去? array里的删除后和数据库里的不对应了怎么办? 2级分类查询
换成
echo "document.write(".mysql_error().");";
echo $newstype . "<br />\n";
改为
echo "document.write(" . addslashes(str_replace("\r\n",'\r\n',$newstype)) . ")";
echo "document.write(" . addslashes(str_replace("\r\n",'\r\n',$newstype)) . ")";
换成
echo "document.write(" . str_replace("\r\n",'\r\n',addslashes($str)) . ")";
<?php
echo "<script language=\"javascript\">";
echo "alert(\"success!\");";
echo "</script>";
?>