无法参数化链接并将其作为HREF作为上述帧位置



我想参数化HREF链接,以便我通过PHP循环传递变量。但是,当我单击文本时,它不会在另一个帧中显示精确的URL并显示URL无效。当我打印参数化的链接并将其作为link存储在document.write()中,但并未将其作为HREF。如何做呢?预先感谢

<!DOCTYPE HTML PUBLIC>
<html>
    <head>
    <script language="javascript" type="text/javascript">
    function trial(a,b) {
        var link='http://localhost/DashboardAsPerCustomer/BlackLotus_'+a+'_hello.php';
        //document.write(link);
        parent.table.location.href='link';
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>This is special</title>
    </head>
    <body>
    <p id="demo"></p>
        <?php
        $names=array("Prajna","Vidya","Deepak","Yajana","Mahadev","Latika","Uzma");
        $y=10;
        for($x=0;$x<count($names);$x++)
        {
            echo'<form method="post"><p onClick="trial('.$x.','.$y.');">'.$names[$x].'</p></form><p>';
        }
        ?>
    </body>
</html>

下面的文件是设置4个不同的帧,当在上述程序中使用PHP循环的文本上发生OnClick时,它将使用传递参数调用JavaScript函数,并在第三帧上打开perticular参数化链接。

>
<!DOCTYPE html>
<html>
    <frameset rows="13%,87%,*%">
        <frame src="header.php" scrolling=no >
        <frameset cols="20%,80%,*%" >
          <frame src="phpinsidephp.php" name="tree" >
            <frameset rows="40%,60%,*%">
              <frame src="http://localhost/JqueryAjax/chart4.php" name="table" scrolling=yes >
              <frame src="Tablesproject_table.php" name="graph" scrolling=no >  
            </frameset>
        </frameset>
    </frameset>
</html>

您必须分配变量link不字符串'link'

parent.table.location.href=link;

最新更新