index = { 
setPageIndex : function(newsId,count){ 
      var basePath = document.getElementById("basePath").value; 
      var news = document.getElementById("newslist"); 
      for(var i=1;i <=count;i++){ 
        html1 +=" <a href='javascript:'"+index.getContent(newsId,i)+">" 
    + i 
    +" </a>" 
    
  }, 
      getContent : function(newsId,i){ 
    
      pagecontent.contentAction(newsId,i,{ 
      callback:function(sContent){ 
      
      index.setContent(sContent); 
      } 
      }) 
  } 

这样写好像错了
我中间的那段超链接加javascript代码错了么? 怎么老是error,fuck!

解决方案 »

  1.   

    " <a href='javascript:index.getContent(\""+newsId+"\",\""+i+"\")>" 
        + i 
        +" </a>" 
      

  2.   

    " <a href='javascript:index.getContent(\""+newsId+"\",\""+i+"\")'>" 
        + i 
        +" </a>"
      

  3.   

    这样好像不行,因为我这上面所有的代码都是在一个script.js里面,这样虽然不报错,但是点击超链接,它根本就没进入下面的index.getContent()方法里面。我alert都没反应!!!
      

  4.   

    <a href='javascript:;' onclick=\"getContent(" + newsId + ",'" + i + "');\">"这样可以嘛?