我现在做一个铃音试听的,当点击试听时,弹出一个新页面,我是这样写的,代码如下:
<a href="javascript:to_try(ling_id)" target="_blank">试听</a>
问题为:新页面能弹出,但是javascript没有执行,我应该怎么做呢?因为我们这个网站都是用javascript来提交内容的,所以我前面的不能改,它必须要提交ling_id到后台执行,然后根据ID获得铃音的全部信息,在新页面上显示出来,请问我该怎么做呢?各位高手帮帮忙啊!

解决方案 »

  1.   

    function to_try(arg){
    document.member.ling_id.value = arg;
    document.member.selector.value = 1;
    document.member.item_code.value = "boost";
    document.member.command.value = 5;
    document.member.next_page.value = "grade/lingTry";
    document.member.curr_page.value = "grade/lingGrade";
    document.member.submit();
    }它是提交到一个servlet的函数,然后在java里找它要的下一个链接,也就是next_page
      

  2.   

    这个function没有执行吗?还是你的弹出页面没有接收到post过来的值?
      

  3.   

    写法怪怪的,href="javascript:to_try(ling_id)" 你可以在to_try的function里调用open或showModalDialog开新窗口亚。
      

  4.   

    我试过了,window.open()后面的参数是一个url,直接用javascript不行,请问要怎么做啊,各位高手帮帮忙吧是弹出的页面没有接收到值,这是为什么啊?怎么样,才能接收到啊?
      

  5.   

    在你的form的action有定义吗? 也就是提交的页面
      

  6.   

    如果window.open(url) 不行的话, 试试 location.href= url ;不过很奇怪,window.open是可以打开指定url的窗口的
      

  7.   

    我想问一下,好像你的意思是在‘-blank’里执行你的JS代码吧?这样行吗?
    是不是先打开了‘-blank’页面,而找不到你的JS啊
    你可以在你的JS 里面加 window.open(url)
      

  8.   

    href=""直接连接servlet 把铃声ID值传过去,这样可以吗??
      

  9.   

    可以,只要servlet的路径对就ok了试试
      

  10.   

    路径对,如果我不弹出新页面,就没有问题,如果弹出的话,它就不执行to_try(arg)函数了
    我也不知道为什么?
      

  11.   

    我都说啦,你的新页面怎么可能有to_try(arg)函数呢? 你可以在你的JS 里面加 window.open(url),要不你就应该开个有内容的页面!
      

  12.   

    请问,window.open(url)中url可以为一个javascript吗?
      

  13.   

    你现在的问题不就是
    <a href="javascript:to_try(ling_id)" target="_blank">试听</a>
    点击试听,然后触发 to_try(ling_id) function提交表单到新开的页面吗?是根本没打开页面还是表单中有很多parameter一个都取不到,还是一些取不到一些能取到??
      

  14.   

    都取不到,在地址栏显示的是:javascript:to_try(1),ling_id能取到,但是这个函数本身没有执行
      

  15.   

    改成javascript:to_try('1') 试试 
      

  16.   

    <A onclick="window.open('javascript:to_try(ling_id)','_blank')" 
                                    href="javascript:void(0)">试听</a>
    我这样写也不行啊,错误一样,请问我到底应该怎样写才可以呢,还是这种做法根本就不通啊?
      

  17.   

    改成javascript:to_try('1')也不行,晕了
      

  18.   

    你试试<a href="javascript:to_try(ling_id)">试听</a>  这样行不行
    先不要在新窗口打开,看看当前页面能不能进入
      

  19.   

    你加我MSN或QQ吧,我MSN是[email protected],QQ是:471480415
      

  20.   

    最后一招 ,form的属性中定义target ,不要在<a></a>中写,试试
      

  21.   

    function to_try(arg){
    document.member.ling_id.value = arg;
    document.member.selector.value = 1;
    document.member.item_code.value = "boost";
    document.member.command.value = 5;
    document.member.next_page.value = "grade/lingTry";
    document.member.curr_page.value = "grade/lingGrade";
    document.member.submit();
    }在每一行中看看你是不是都正确执行了javascript里面的变量根平常的不同
      

  22.   

    把你的页面跳专写到javascript中试试
      

  23.   

    <div id="topDiv" onClick="mainTable.initMoveTable();">
    <table height="1%" width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr> 
    <td width="1%"><img src="images/bottom1.jpg" width="15" height="31"></td>
    <td width="98%" nowrap background="images/bottom2.jpg" class="divCell">试听</td>
    <td width="1%"><img src="images/bottom3.jpg" width="15" height="31"></td>
      </tr>
    </table>
      </div>
    如果是没执行,就用个层把你要做的字符放进去看看!
      

  24.   

    不行的话就用get方式提交把 xxx.jsp?id=xxx&name=xxx&.......
      

  25.   

    div id="topDiv" onClick="javascript:to_try(ling_id);">
    <table height="1%" width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr> 
    <td width="98%" nowrap background="images/bottom2.jpg" class="divCell">试听</td>
    </tr>
    </table>
    </div>
      

  26.   

    再不行,你把 ‘试听’做成按钮得,这样Onlick ,OnMousedown 都容易触发!
      

  27.   

    <a href="javascript:to_try(ling_id)" target="_blank">试听</a>
    把 target="_blank"去掉!!!
      

  28.   

    <a href='#' onclick=window.open('http://jingcai.chinagames.net/bet/client/BetMatchInit.do?betId=67','bet','scrollbars=no,width=467,height=501')><font color='white' size='4'><b>[世界杯]有奖竞猜,对阵 德国(让0.5球)VS瑞典:现在火爆竞猜中</b></font></a>
      

  29.   

    <a href='#' onclick=window.open。。
      

  30.   

    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    }
    //-->
    </script>
    <%# isRing("试听",ling_id)%>
    protected string isRing(object a,object b)
    {
    if(a.ToString()=="")
    {
    return null;
    }
    else
    {
    return"<a href=# onclick=MM_openBrWindow('ringpre.aspx?id="+b+"','彩图','width=450,height=300')>"+a+"</a>";

    }
    }这两天刚写的.
      

  31.   

    引用javascript函数是net编码,不知道识不适合java