url后面不能直接接kw=吧,比如url="www.baidu.com"那不是输出结果就为"www.baidu.comkw="

解决方案 »

  1.   

    我这边模拟写了一个function<script language="javascript" type="text/javascript">
        function test()
        {
            var url = "www.sina.com";
            var aaa = "aaa";
            var bbb = "bbb";
            var ccc = "ccc";
            var str_content = "<li><a href='"+url+"kw="+ aaa +"' title=\""+bbb+"\">"+ccc+"</a></li>";
            
            alert(str_content);
        }
    </script>打印出来的结果是:<li><a href='www.sina.comkw=aaa' title="bbb">ccc</a></li>
    先不说这个href是不是少了?号,你是不是想href='www.sina.com?kw=aaa'
    就算少了?号也不至于报 "不支持此属性或者方法"
    检查你传的每一个参数,肯定是有参数没处理好。
      

  2.   


    同意,我这么写的也没报错
    var c = 'abcad';
    var url="www.baidu.com?"var str_content ="<li><a href='"+url+"kw="+c+"' title=\""+c+"\">"+c+"</a>  </li>";
    alert(str_content)
      

  3.   

    我调用AJAX返回的值竟然是这个东西?为什么?<html>
        <head>
            <title>Not Found</title>
            <style>
             body {font-family:"Verdana";font-weight:normal;font-size: 8pt;color:black;} 
             p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
             b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
             h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
             h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
             pre {font-family:"Lucida Console";font-size: 8pt}
             .er {font-weight: bold; color: black;text-decoration: none;}
             .version {color: gray;}
             .error {margin-bottom: 10px;}
             .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
            </style>
        </head>
        <body bgcolor="white">            <span><h1>“/weixin”应用程序中的服务器错误。<hr width=100% size=1 color=silver></h1>            <h2> <i>HTTP 错误 404 - Not Found。</i> </h2></span>            <hr width=100% size=1 color=silver>            <b>版本信息:</b>&nbsp;ASP.NET Development Server 9.0.0.0            </font>    </body>
    </html>
      

  4.   

    encodeURI() 函数可把字符串作为 URI 进行编码。语法
    encodeURI(URIstring)
    参数 描述 
    URIstring 必需。一个字符串,含有 URI 或其他要编码的文本。 返回值
    URIstring 的副本,其中的某些字符将被十六进制的转义序列进行替换。实例
    在本例zhogn,我们将使用 encodeURI() 对 URI 进行编码:<script type="text/javascript">document.write(encodeURI("http://www.w3school.com.cn")+ "<br />")
    document.write(encodeURI("http://www.w3school.com.cn/My first/"))
    document.write(encodeURI(",/?:@&=+$#"))</script>
    输出:http://www.w3school.com.cn
    http://www.w3school.com.cn/My%20first/
    ,/?:@&=+$#
      

  5.   

    检查你的 typeof c[i] 是不是 string,这一行代码只有这里可能出现该类错误。把上下文的代码贴出来看看。如果你是用ie出现的这个错误,把上面的几行也发出来,ie的提示定位不准
      

  6.   

    就是string类型,就是:
    <html>
        <head>
            <title>Not Found</title>
            <style>
                body {font-family:"Verdana";font-weight:normal;font-size: 8pt;color:black;} 
                p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
                b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
                h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
                h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
                pre {font-family:"Lucida Console";font-size: 8pt}
                .er {font-weight: bold; color: black;text-decoration: none;}
                .version {color: gray;}
                .error {margin-bottom: 10px;}
                .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
            </style>
        </head>
        <body bgcolor="white">            <span><h1>“/weixin”应用程序中的服务器错误。<hr width=100% size=1 color=silver></h1>            <h2> <i>HTTP 错误 404 - Not Found。</i> </h2></span>            <hr width=100% size=1 color=silver>            <b>版本信息:</b>&nbsp;ASP.NET Development Server 9.0.0.0            </font>    </body>
    </html>
      

  7.   

    看来是发送的URL虚拟地址出错啦,关键那地址咋改都不行,郁闷死啦,维护别人做的网站真是麻烦!
      

  8.   


    能输出str_content看下么?确定路径是否正确.