简体   繁体   中英

How to encode URL in javascript function as a parameter?

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. MY javascript code

 <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> 

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.

Now i am using double quote for parameter

 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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM