如何在javascript函数中将URL编码为参数?

时间:2021-09-03 10:28:02

1.Hey Everyone I am try to call new page when i click on Button while i have made button in HTML table where data retrieve from Database. For this i made javascript function have URL as a parameter and i pass parameter in Function call on onClick attribute but it does not work plz guide me thanks in advance

1.Hey每个人当我点击按钮时我试图调用新页面,而我在HTML表格中创建了数据从数据库中检索的按钮。为此我使javascript函数有URL作为参数,我在onClick属性的函数调用中传递参数但它不起作用plz指导我提前感谢

  1. MY javascript code
  2. 我的javascript代码

<script type="text/javascript">
function popUp(url) {
window.open(url,'PHP Pop Up','width=300,height=300');
}
</script>
<td><form action='detailform.php' method='POST'><input type='button' onclick='popUp('http://localhost/Prac/UpdatePage.php')' name='tempId' id='".$row["ID"]."' value='Edit'/><form></td>

2 个解决方案

#1


0  

try

<td><form action='detailform.php' method='POST'><input type='button' onclick='popUp("http://localhost/Prac/UpdatePage.php")' name='tempId' id='".$row["ID"]."' value='Edit'/><form></td>

You cant use same quote for onclick and for parameter. i changed it.

你不能为onclick和参数使用相同的引用。我改变了

Now i am using double quote for parameter

现在我使用参数的双引号

#2


0  

Succesfully by removing colons
<td><form action='detailform.php' method='POST'><input type='button' onclick=popUp('http://localhost/Prac/UpdatePage.php') name='tempId' id='".$row["ID"]."' value='Edit'/><form></td>

#1


0  

try

<td><form action='detailform.php' method='POST'><input type='button' onclick='popUp("http://localhost/Prac/UpdatePage.php")' name='tempId' id='".$row["ID"]."' value='Edit'/><form></td>

You cant use same quote for onclick and for parameter. i changed it.

你不能为onclick和参数使用相同的引用。我改变了

Now i am using double quote for parameter

现在我使用参数的双引号

#2


0  

Succesfully by removing colons
<td><form action='detailform.php' method='POST'><input type='button' onclick=popUp('http://localhost/Prac/UpdatePage.php') name='tempId' id='".$row["ID"]."' value='Edit'/><form></td>