1
我的彈出窗口工作正常,直到變量中有一些空格或特殊字符(如#等) 例如,如果我的引用變量類似於'12345'但是當涉及空格和特殊字符時,它不起作用。 我正在使用php結合javascript彈出窗口來查看項目的每個參考。通過彈出窗口在url中跳轉空格和特殊字符
<script type="text/javascript">
function PopupCenter(pageURL, title,w,h)
{
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
<?php
$sql = "SELECT * from purchase_tb ORDER BY ponumber ASC ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "
<div class='table-responsive'>
<table class='table table-bordered table-hover table-condensed '>
<tr class='success'><th>PO.Number</th><th> Model </th><th>Date Created</th>
</tr>";
$current_cat = null;
while($row = $result->fetch_assoc()) {
if ($row["ponumber"] != $current_cat) {
$current_cat = $row["ponumber"];
$current_cat2 = $row["datecreated"];
echo "
<tr><td>";
echo"
{$current_cat}</td>
<td><a href='#' onclick=PopupCenter('viewpurchase.php?Rid=".$row['ponumber']."','myPop1',1000,800)>View</a></td><td>{$current_cat2}</td>";
?>
它的工作原理!謝謝! :) – EHEM
好聽!當我開始時,那個人也抓到了我。在路上看看像TWIG這樣的模板引擎。模板引擎擅長做例行,乏味,但是必要的東西,比如編碼URL。 – geeves