我这些需要处理一个javascript响应函数,它的参数是通过<?echo "好吗"; ?>传递进来的。可是为什么我的函数没有反应呢,我这里是用alert来处理的;但是我要是改成其他字符比如<?echo "aa11"; ?>它就能正常显示。这是怎么回事呀?
好急呀!网上查了一天了也没有答案。

解决方案 »

  1.   

    这是我的测试代码:<?php
    //此函数主要是对与数据库中的语句预定义自负添加反斜杠,get_magic_quotes_gpc用来检测是否添加了反斜杠,addslashes用来添加反斜杠
     function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
     {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;  switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
      }
      return $theValue;
     }
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    .style15 {font-size: 14px; font-weight: bold; }
    -->
    </style>
    </head><body>
    <table width="1379" height="117" border="1" id="table1">
      <form name="form1" method="post" action="textarea1.php" enctype="multipart/form-data">
      <tr>
        <td id="ttt1">heheheheheheh</td>
        <td><a onClick="javascript:func(a=<? echo "22"; ?>)">选择</td>
        <td id="t">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>
          <input type="submit" name="submit" value="提交">
          <input type="button" name="delete" value="删除">
        </td>
      </tr>
      <input type="hidden" name="MM_insert" value="form1">
      </form>
    </table>
    </body>
    <script type="text/javascript" language="javascript">
    function func(a)
    {
        alert(a);
    }
    </script>
    </html>你说的是这个意思吗?
      

  2.   

    <a onClick="func('<? echo "好吗"; ?>');">