 |
|
|
 |
 |
|
window.open หาดูนะ
|
 |
 |
 |
 |
Date :
2009-12-06 19:35:44 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จุดอ่อนของผมตอนนี้คือ..การใส่htmlลงในphpอ่ะครับ..เลยงงๆครับวานท่านผู้รู้ช่วยชี้แนะด้วยนะครับ
|
 |
 |
 |
 |
Date :
2009-12-06 19:53:56 |
By :
teekaiman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code
function popup(setURL, setWidth, setHeight, setScrollBar){
var setLeft=(screen.width-setWidth) / 2;
var setTop=(screen.height-setHeight) / 2;
var windows = window.open(setURL, "mypopup", "scrollbars=" + setScrollBar + ", status=0, location=0, toolbar=0, menubar=0, directories=0, resizable=0, width=" + setWidth + ", height=" + setHeight + ", top=" + setTop + ", left=" + setLeft);
windows.focus();
}
<a href="javascript:popup('big_picture/HL_100I.php',900,458,0);">Open Popup</a>
|
 |
 |
 |
 |
Date :
2009-12-06 19:54:16 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่ประมาณนี้หรือปล่าวครับผ๋มลองดูแล้วมันไม่ได้ครับอ่ะครับ:erm
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<?php
$keyword = $_POST[keyword];
if ($keyword=="") {
echo "<h3>ERROR : กรุณากรอกคำค้นด้วยครับ</h3>";
exit();
}
?>
<html>
<head><title>Web Director</title>
</head>
<body>
<h1>:: web directory ::</h1>
<p>
<b>ผลการค้นหาข้อมูลจากคำค้น "<?=$keyword?>"</b>
<ul>
<?php
function popup(setURL, setWidth, setHeight, setScrollBar){
var setLeft=(screen.width-setWidth) / 2;
var setTop=(screen.height-setHeight) / 2;
var windows = window.open(setURL, "mypopup", "scrollbars=" + setScrollBar + ", status=0, location=0, toolbar=0, menubar=0, directories=0, resizable=0, width=" + setWidth + ", height=" + setHeight + ", top=" + setTop + ", left=" + setLeft);
windows.focus();
}
include "connect.php";
$sql = "select * from search where title like '%$keyword%' ";
$result = mysql_db_query($dbname,$sql);
while ($rs = mysql_fetch_array($result)) {
$id = $rs[id];
$title = $rs[title];
$url = $rs[url];
echo "<li>";
echo "<b><a href="javascript:popup('$url',900,458,0);">$title</a></b>";
echo "</li>";
}
?>
</ul>
</body>
</html>
|
 |
 |
 |
 |
Date :
2009-12-06 20:13:18 |
By :
teekaiman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
น่านมัน javascript ครับ ไม่ใช่ php
Code
<script type="text/javascript">
function popup(setURL, setWidth, setHeight, setScrollBar){
var setLeft=(screen.width-setWidth) / 2;
var setTop=(screen.height-setHeight) / 2;
var windows = window.open(setURL, "mypopup", "scrollbars=" + setScrollBar + ", status=0, location=0, toolbar=0, menubar=0, directories=0, resizable=0, width=" + setWidth + ", height=" + setHeight + ", top=" + setTop + ", left=" + setLeft);
windows.focus();
}
</script>
|
 |
 |
 |
 |
Date :
2009-12-06 20:33:44 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
งั้นแก้เป็นแบบนี้มันก็ error อีกอ่ะครับผ๋ม 
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<?php
$keyword = $_POST[keyword];
if ($keyword=="") {
echo "<h3>ERROR : กรุณากรอกคำค้นด้วยครับ</h3>";
exit();
}
?>
<html>
<head><title>Web Director</title>
<script type="text/javascript">
function popup(setURL, setWidth, setHeight, setScrollBar){
var setLeft=(screen.width-setWidth) / 2;
var setTop=(screen.height-setHeight) / 2;
var windows = window.open(setURL, "mypopup", "scrollbars=" + setScrollBar + ", status=0, location=0, toolbar=0, menubar=0, directories=0, resizable=0, width=" + setWidth + ", height=" + setHeight + ", top=" + setTop + ", left=" + setLeft);
windows.focus();
}
</script>
</head>
<body>
<h1>:: web directory ::</h1>
<p>
<b>ผลการค้นหาข้อมูลจากคำค้น "<?=$keyword?>"</b>
<ul>
<?php
include "connect.php";
$sql = "select * from search where title like '%$keyword%' ";
$result = mysql_db_query($dbname,$sql);
while ($rs = mysql_fetch_array($result)) {
$id = $rs[id];
$title = $rs[title];
$url = $rs[url];
echo "<li>";
echo "<b><a href='javascript:popup('$url',900,458,0);'>$title</a></b>";
echo "</li>";
}
?>
</ul>
</body>
</html>
|
 |
 |
 |
 |
Date :
2009-12-06 20:53:28 |
By :
teekaiman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
error ว่ากะไรครับ
|
 |
 |
 |
 |
Date :
2009-12-06 20:56:47 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือมันไม่ลิงค์อ่ะครับผ๋ม
|
 |
 |
 |
 |
Date :
2009-12-06 21:01:57 |
By :
teekaiman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลอง view source แล้วเอามาแปะดูครับ
|
 |
 |
 |
 |
Date :
2009-12-06 21:06:21 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
source ครับผ๋ม
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<?php
$keyword = $_POST[keyword];
if ($keyword=="") {
echo "<h3>ERROR : กรุณากรอกคำค้นด้วยครับ</h3>";
exit();
}
?>
<html>
<head><title>Web Director</title>
<script type="text/javascript">
function popup(setURL, setWidth, setHeight, setScrollBar){
var setLeft=(screen.width-setWidth) / 2;
var setTop=(screen.height-setHeight) / 2;
var windows = window.open(setURL, "mypopup", "scrollbars=" + setScrollBar + ", status=0, location=0, toolbar=0, menubar=0, directories=0, resizable=0, width=" + setWidth + ", height=" + setHeight + ", top=" + setTop + ", left=" + setLeft);
windows.focus();
}
</script>
</head>
<body>
<h1>:: web directory ::</h1>
<p>
<b>ผลการค้นหาข้อมูลจากคำค้น "<?=$keyword?>"</b>
<ul>
<?php
include "connect.php";
$sql = "select * from search where title like '%$keyword%' ";
$result = mysql_db_query($dbname,$sql);
while ($rs = mysql_fetch_array($result)) {
$id = $rs[id];
$title = $rs[title];
$url = $rs[url];
echo "<li>";
echo "<b><a href='javascript:popup('$url',900,458,0);'>$title</a></b>";
echo "</li>";
}
?>
</ul>
</body>
</html>
อันนี้ภาพ ERROR ครับผ๋มคลิกลิงค์แล้วมันเป็นแบบเนี๊ยครับผ๋ม

|
 |
 |
 |
 |
Date :
2009-12-06 21:10:26 |
By :
teekaiman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
echo "<b><a href=\"javascript:popup('".$url."',900,458,0);\">".$title."</a></b>";
|
 |
 |
 |
 |
Date :
2009-12-06 21:21:49 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ป๊าดดดดดดดดด...ได้แล้วครับผ๋ม ขอบคุณครับ ไอ้เครื่องหมาย Backslash หน้า double Quote นี่มันคุ้นๆอ่ะครับรู้สึกว่ามันเป็นเงื่อนไขการกำหนดสตริงอ่ะปล่าวครับ เคยอ่านคุ้นๆครับ
|
 |
 |
 |
 |
Date :
2009-12-06 21:34:14 |
By :
teekaiman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อันนี้ก็ได้เหมือนกันครับจากตัวอย่างงับ
echo "<b><a href='#mark' onClick=\"window.open('".$url."','_blank','width=900,height=458,scrollbars=no,menubar=no,status=NO,resizable=no,Top=150,Left=30');\" >".$title."</a></b>";
|
 |
 |
 |
 |
Date :
2009-12-06 21:43:23 |
By :
teekaiman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|