试图在JavaScript弹出窗口中传递两个变量
我正在调用下面的脚本,现在我需要能够将两个值发送到试图在JavaScript弹出窗口中传递两个变量,javascript,php,Javascript,Php,我正在调用下面的脚本,现在我需要能够将两个值发送到test23.phplike 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");}</scri
test23.php
like
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>
函数myFunction20(url){window.open('test23.php?id='+url,“_blank”,“toolbar=no,scrollbars=no,resizeable=no,top=70,left=50,width=1200,height=500”);}
PHP代码
echo "<td>" .'<a href= javascript:myFunction20("'.$row['Account_Number'].'","'.$row['Account_Number'].'")>'.$row['Name'].'</a>' . "</td>";
echo“。"";
只需在查询字符串中添加第二个键/值对:
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");
}
您应该将PHP变量用引号括起来,并将其传递给JS函数
<?php
$parameter1 = "'" . $row['Account_Number'] . "'";
$parameter2 = "'" . $row['Account_Number'] . "'";
echo
'<td>
<a href= javascript:myFunction20(' . $ip . ',' . $id . ')>' . $row["Name"] . '</a>
</td>';
<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>