我正在调用下面的脚本,现在我需要能够向test23.php
发送两个值,例如
myFunction20(url,url2)
有人可以帮忙吗?
<script>
function myFunction20(url) {window.open('test23.php?id=' + url, "_blank", "toolbar=no,scrollbars=no,resizable=no,top=70,left=50,width=1200,height=500");}</script>
PHP代码
echo "<td>" .'<a href= javascript:myFunction20("'.$row['Account_Number'].'","'.$row['Account_Number'].'")>'.$row['Name'].'</a>' . "</td>";
答案 0 :(得分:0)
只需在查询字符串中添加第二个键/值对:
function myFunction20(url) {
window.open('test23.php?id=' + url + "&SECOND_KEY=" + "SECOND_KEY_VALUE",
"_blank",
"toolbar=no, scrollbars=no, resizable=no, top=70, left=50, width=1200, height=500");
}
答案 1 :(得分:0)
你应该用引号括起PHP变量并将它传递给你的JS函数
<?php
$parameter1 = "'" . $row['Account_Number'] . "'";
$parameter2 = "'" . $row['Account_Number'] . "'";
echo
'<td>
<a href= javascript:myFunction20(' . $ip . ',' . $id . ')>' . $row["Name"] . '</a>
</td>';
你的JS功能
<script>
function myFunction20(url, url2) {
window.open('test23.php?id=' + url + '&' + url2, "_blank", "toolbar=no,scrollbars=no,resizable=no,top=70,left=50,width=1200,height=500");
}
</script>