|
|
|
เกิดปัญหาแว้ววว คือว่าหนูเขียนหน้าเก็บผลงานค่ะ ซึ่งผลงานนั้นๆสามารถมีเจ้าของผลงานได้หลายคนอ่ะค่ะ แล้วหนูจะทำเป็นปุ่มให้เพิ่มอ่ะค่ะ |
|
|
|
|
|
|
|
ขอบคุณคร๊าคุณPlaKriM เจ้าAjax ไม่เคยเขียนเลย ได้ยินแต่ชื่อและไม่เคยอยากจะยุ่งมันเลย ในที่สุดก็ต้องยุ่งจนได้ ตายแน่ๆ จะศึกษาต่อไปค่ะ เฮ้ยเหนื่อยเลย ฮือออออ
|
|
|
|
|
Date :
2010-11-11 21:50:57 |
By :
moo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากมายคร๊า
|
|
|
|
|
Date :
2010-11-12 20:56:15 |
By :
moo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยดูใหหน่อยน่ะค่ะ คือว่าเมื่อเอามันมาใส่ในหน้าของตัวเองมันดันเพิ่มไม่ได้อ่ะค่ะ เครยดจัง ความรู้ด้านสคริป แล้วก็Ajaxไม่มีเลยอ่า
นี้เป็นโค๊ดอ่ค่ะ
Code (PHP)
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>:: แสดงข้อมูลประเภทผลงาน ::</title>
<style type="text/css">
<!--
body {
background-image: url(../image/bg.gif);
}
.font1 {
font-family: Tahoma, BrowalliaUPC, AngsanaUPC;
font-size: 12px;
font-style: normal;
color: #666666;
font-weight: bolder;
}
.font2 {
font-family: Tahoma, BrowalliaUPC, AngsanaUPC;
font-size: 14px;
font-weight: normal;
color: #000099;
}
.style2 {font-size: 36px}
-->
</style>
</head>
<script language="javascript">
function fncCreateElement(){
var mySpan = document.getElementById('mySpan');
var myLine = document.getElementById('hdnLine');
myLine.value++;
// Create input text
var myElement1 = document.createElement('input');
myElement1.setAttribute('type',"text");
myElement1.setAttribute('name',"txtGalleryName"+myLine.value);
myElement1.setAttribute('id',"txt"+myLine.value);
mySpan.appendChild(myElement1);
// Create input file
var myElement2 = document.createElement('input');
myElement2.setAttribute('type',"file");
myElement2.setAttribute('name',"fileUpload"+myLine.value);
myElement2.setAttribute('id',"fil"+myLine.value);
mySpan.appendChild(myElement2);
// Create <br>
var myElement3 = document.createElement('<br>');
myElement3.setAttribute('id',"br"+myLine.value);
mySpan.appendChild(myElement3);
}
function fncDeleteElement(){
var mySpan = document.getElementById('mySpan');
var myLine = document.getElementById('hdnLine');
if(myLine.value > 1 )
{
// Remove input text
var deleteFile = document.getElementById("txt"+myLine.value);
mySpan.removeChild(deleteFile);
// Remove input file
var deleteFile = document.getElementById("fil"+myLine.value);
mySpan.removeChild(deleteFile);
// Remove <br>
var deleteBr = document.getElementById("br"+myLine.value);
mySpan.removeChild(deleteBr);
myLine.value--;
}
}
</script>
<body>
<table width="200" border="3" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td height="281" valign="top"><table width="980" height="79%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="980" height="150" valign="top"><img src="../image/head.jpg" width="980" height="150" /></td>
</tr>
<tr>
<td width=100% height="40" bgcolor="#3e647e"><table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="130"><a href="../html/adviser_manage.php"><img src="../image/h_bar.gif" width="130" height="40" border="0" /></a></td>
<td width="13"><img src="../image/k_bar.gif" width="50%" height="40" /><img src="../image/_bar.gif" width="50%" height="40" /></td>
<td width="170"><img src="../image/_bar.gif" width="183" height="40" border="0" /></td>
<td width="537"><img src="../image/_bar.gif" width="97%" height="40" /><img src="../image/k_bar.gif" width="1%" height="40" /><img src="../image/_bar.gif" width="2%" height="40" /></td>
<td width="130"><a href="logout.php"><img src="../image/logout_bar.gif" width="170" height="40" border="0" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="32" valign="top"><table width="980" height="302" border="0" align="top" cellpadding="0" cellspacing="0">
<tr>
<td width="30" height="302" align="center" valign="top"><table width="980" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="84" height="25"> </td>
<td width="163">
<?
$id_sub = $_REQUEST['subname'];
$name_eng = $_POST['name_eng'];
$name_thai = $_POST['name_thai'];
$advname = $_REQUEST['advname'];
$year= $_POST['year'];
$grade = $_POST['grade'];
$id_owner = $_REQUEST['id_owner'];
$abstract = $_POST['abstract'];
$discript = $_POST['discript'];
//เก็บค่าลง SESSION
$_SESSION['id_sub']=$id_sub;
$_SESSION['name_eng']=$name_eng;
$_SESSION['name_thai']=$name_thai ;
$_SESSION['advname']=$advname;
$_SESSION['year']=$year;
$_SESSION['grade']=$grade;
$_SESSION['id_owner']=$id_owner;
$_SESSION['abstract']=$abstract;
$_SESSION['discript']=$discript;
$name_thai = $_SESSION['name_thai'];
/*$id_sub = $_SESSION['id_sub'];
$name_eng = $_SESSION['name_eng'];
$name_thai = $_SESSION['name_thai'];
$advname = $_SESSION['advname'];
$year= $_SESSION['year'];
$grade = $_SESSION['grade'];
$id_owner = $_SESSION['id_owner'];
$abstract = $_SESSION['abstract'];
$discript = $_SESSION['discript'];
echo"$id_sub</br>";
echo"$name_eng</br>";
echo"$name_thai</br>";
echo"$advname</br>";
echo"$year</br>";
echo"$grade</br>";
echo"$id_owner</br>";
echo"$abstract</br>";
echo"$discript</br>";*/
?> </td>
<td width="88"> </td>
<td width="162"> </td>
<td width="124"> </td>
<td width="103"> </td>
<td width="212" class="font2"> </td>
<td width="44"> </td>
</tr>
</table>
<table width="100%" height="273" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="47" colspan="3" background="../image/frame1.gif"><table width="100%" height="47" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="9%" height="22"> </td>
<td width="16%"> </td>
<td width="9%"> </td>
<td width="16%"> </td>
<td width="13%"> </td>
<td width="26%"> </td>
<td width="7%"> </td>
<td width="4%"> </td>
</tr>
<tr>
<td height="25"> </td>
<td align="center" class="font2">เพิ่มข้อมูลผลงานนักศึกษา</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="39" height="154" background="../image/frame2.gif"> </td>
<td width="899" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%"> </td>
<td width="10%"> </td>
<td width="28%"> </td>
<td width="40%"> </td>
<td width="2%"> </td>
</tr>
<tr>
<td> </td>
<td align="right" class="font1">ชื่อผลงาน : </td>
<td colspan="2" align="left" class="font1"> <? echo"$name_thai</br>";?></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="right" class="font1"> </td>
<td align="left" class="font1"> </td>
<td> </td>
<td> </td>
</tr>
</table> <form action="php_multiple_upload5.php" method="post" name="form1" enctype="multipart/form-data">
<input type="text" name="txtGalleryName1"><input type="file" name="fileUpload1">
<input name="btnCreate" type="button" value="+" onClick="JavaScript:fncCreateElement();">
<input name="btnDelete" type="button" value="-" onClick="JavaScript:fncDeleteElement();"><br>
<span id="mySpan"></span>
<input name="hdnLine" type="hidden" value="1">
<input name="btnSubmit" type="submit" value="Submit">
</form></td>
<td width="42" height="154" background="../image/frame3.gif"> </td>
</tr>
<tr>
<td height="72" colspan="3" background="../image/frame4.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30%"> </td>
<td width="42%"> </td>
<td width="23%" class="font2"> </td>
<td width="5%"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td class="font2"> </td>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="19" background="../image/k.gif"> </td>
</tr>
<tr>
<td height="38"><div align="right" class="font1">Copyright © 2010 Student' Rewards Retrieval System.<br />
All rights reserved. Best view 1024*768 pixel, IE Browser.</div></td>
</tr>
</table></td>
</tr>
</table>
<div align="center"></div>
</body>
</html>
|
|
|
|
|
Date :
2010-11-17 15:36:42 |
By :
panisa.w |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
^
^
^
หนูแทรกสคริปผิดที่ป่ะเนี๊ย ช่วยหนูหน่อยเถอะค่ะ
|
|
|
|
|
Date :
2010-11-18 10:52:33 |
By :
panisa.w |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอาไว้เป็นตัวอย่างละกันครับไม่รู้ว่าใช้เพิ่มอย่างนี้หรือเปล่า
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var id = document.getElementById("id").value;
$('#add-row').click(function(){
var tr = $('<tr id="row'+id+'"></tr>');
var td1 = $('<td width="55"><input type="text" name="id[]" id="id[]" value=""/></td>');
var td2 = $('<td width="152"><input type="text" name="name[]" id="name[]" value=""/></td>');
var td3 = $('<td width="102"><a href=\'#\' onClick="removeFormField(\'#row'+id+'\'); return false;">Remove</a></td>');
tr.append(td1);
tr.append(td2);
tr.append(td3);
$('#tbl-product').append(tr);
id = (id - 1) + 2;
document.getElementById("id").value = id;
});
$("#delete-row").click(function(){
if($("#tbl-product tr").size()>1){
$("#tbl-product tr:last").remove();
}else{
alert("ต้องมีรายการข้อมูลอย่างน้อย 1 รายการ");
}
});
})
function removeFormField(id) {
$(id).remove();
}
</script>
</head>
<body>
<input type="hidden" id="id" value="1">
<table width="309px" id="tbl-product">
<tr>
<td width="55">id</td>
<td width="152">name</td>
<td width="102">remove</td>
</tr>
</table>
<table width="113" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="59"><input type="button" name="add-row" id="add-row" value="เพิ่มแถว" /></td>
<td width="186"><input type="button" name="delete-row" id="delete-row" value="ลบแถว" /></td>
</tr>
</table>
</body>
</html>
โค้ดตัวอย่างจากเว็บ http://www.ninenik.com/ ครับ
|
|
|
|
|
Date :
2010-11-18 11:27:59 |
By :
ไวยวิทย์ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แว้วๆๆๆๆ ขอบคุณคร๊า
|
|
|
|
|
Date :
2010-11-18 12:56:41 |
By :
panisa.w |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|