Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP Forum > ถ้า insert จาก popup แล้วให้ไปแสดงค่าที่เมนูหลักต้องทำยังไง



 

ถ้า insert จาก popup แล้วให้ไปแสดงค่าที่เมนูหลักต้องทำยังไง

 



Topic : 072455

Guest




คือผม insert ข้อมูลผ่านตัว popup และหลีง insert ให้มันส่งข้อมูลกลับไป form หลักอ่ะครับ
เช่น
main form click popup(upload.asp--->uploads1.asp) return mainform



Tag : ASP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-01-23 10:50:23 By : Clamore View : 1567 Reply : 8
 

 

No. 1

Guest


ที่ ตัว Popup เอาไว้ล่างสุด

<script language='JavaScript'>
alert('Update Complete');
window.opener.document.getElementById('textbox1').value = "ค่าที่ต้องการส่งกลับ";
</script>



ลองดูครับ ว่าใช่สิ่งที่ต้องการหรือเปล่า






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-23 11:53:11 By : Thep
 


 

No. 2



โพสกระทู้ ( 297 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : Thep เมื่อวันที่ 2012-01-23 11:53:11
รายละเอียดของการตอบ ::
ที่ ตัว Popup เอาไว้ล่างสุด

<script language='JavaScript'>
alert('Update Complete');
window.opener.document.getElementById('textbox1').value = "ค่าที่ต้องการส่งกลับ";
</script>


ลองดูครับ ว่าใช่สิ่งที่ต้องการหรือเปล่า


คือผมใส่ไม่ถูกอ่ะ

หน้าแรกที่ใช้เปิดPopup(insertnew)
<%
session.CodePage ="65001"
if Session("user")="" then
	Response.Redirect("../login.asp")
end if
%>
<!--#include file="userheader.asp"-->
<!--#include file="usermenu.asp"-->
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script language="javascript">
function ints()
{
	if (document.innew.txttitle.value == "")
	{
		alert('"กรุณาใส่หัวข้อด้วย');
		document.innew.txttitle.focus();
		return false;
	}
	if (document.innew.txtdetail.value == "")
	{
		alert('"กรุณาใส่รายละเอียดด้วย');
		document.innew.txtdetail.focus();
		return false;
	}
	
	if (document.innew.txtetc.value == "")
	{
		alert('"ถ้าไม่ใส่หมายเหตุ กรุณาใส่ - ด้วย');
		document.innew.txtetc.focus();
		return false;
	}
	
	if (document.innew.txttype.value == "")
	{
		alert('"กรุณาเลือกส่วนงานด้วย');
		document.innew.txttype.focus();
		return false;
	}
	
	document.innew.submit();
	
}
function submits(page)
{
	if (page=="upload")
	{
		document.innew.action="uploads.asp"
	}
	document.innew.submit();
}
function popup()
{
	window.open('uploads.asp','upload','width=250,height=20,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0'); 
}
		

</script>

</head>
<td class="f2">

<form action="insertnews.asp"  method="post" name="innew" onsubmit="javascript:return ints()"  >
<table width="80%" border="1" style="width:50%">
	<th colspan="2" align="center">เพิ่มข่าวใหม่ </th>
    <tr>
    	<td valign="top" width="200">หัวข้อ</td>
        <td><input name="txttitle" type="text" size="70" /> </td>
    </tr>
    <tr>
    	<td valign="top" width="200">รายละเอียด</td>
        <td><textarea name="txtdetail" cols="70" rows="5"></textarea></td>
    </tr>
     <tr>
    	<td valign="top" width="200">ส่วนประกาศ</td>
        <td><select name="txtcall">  
       	   <option value="ข่าวประชาสัมพันธ์" selected="selected">ข่าวประชาสัมพันธ์</option>
          <option value="ข่าวประกาศ">ข่าวประกาศ</option>
          <option value="ข่าวกิจกรรม">ข่าวกิจกรรม</option>
          <option value="ข่าวการศึกษาก่อนปริญญา">ข่าวการศึกษาก่อนปริญญาตรี</option>
          <option value="ข่าวการศึกษาหลังปริญญา">ข่าวการศึกษาหลังปริญญาตรี</option>
        </select></td>
    </tr>
    <tr>
    	<td valign="top" width="200">หมายเหตุ</td>
        <td><input name="txtetc" type="text" size="70" /> </td>
    </tr>
    <tr>
    	<td valign="top" width="200">ส่วนงาน</td>
        <td><select name="txttype">  
          <option value="" selected="selected">กรุณาเลือก</option>
          <%
		  dim sqltype,rectype
		  sqltype="select * from unit "
		  set rectype=Server.CreateObject("ADODB.Recordset")
		  rectype.open sqltype,con
		  while not rectype.EOF
		  %>
          <option value="<%=rectype.fields("unitid").value%>" ><%=rectype.fields("unitname").value%></option>
          <%
		  rectype.movenext
		  wend
		  rectype.close()
		  set rectype=nothing
		  %>
        </select> </td>
    </tr>
    <tr>
    	<td valign="top" width="200">เอกสารแนบ</td>
        <td> 
	<a href="#" onclick="popup();"><font  color="#ff0000"><b>แนบเอกสาร</b></font></a>------<ใช้เปิดหน้าPOPUp
	<input type="hidden" name="hidefile1" id="hidefile1" value="">
        </td>
    </tr>
     <tr>
    	<td colspan="2" align="center">
        <input name="submit" type="submit" value="บันทึก" />
        <input name="Reset" type="reset" value="ยกเลิก" />
        </td>
    </tr>
</table>
</form>

</td>
</tr>
</table>
<!--#include file="footer.asp" -->


หน้าPOPUP1(uploads.asp)
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body>
<%
	Session.Codepage="65001"
%>
<form method="post" action="uploads1.asp" enctype="multipart/form-data">
	<input type="file" name="file1">
	<input type="submit" value="อัพโหลด">
</form>
</body>

</html>


หน้าPOPUP2(uploads.asp)
<!--#include file="connect.asp" -->
<%

Dim mySmartUpload

	'*** Create Object ***'	
	Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
	mySmartUpload.CodePage="UTF-8"
	
	'*** Upload Files ***'
	mySmartUpload.Upload
	
	'*** Upload file1 ***'
	If mySmartUpload.Files("file1").FileName <> "" Then
		mySmartUpload.Files("file1").SaveAs(Server.MapPath("uploads/" & mySmartUpload.Files("file1").FileName))
		'Response.write mySmartUpload.Files("file1").Name & " Uploaded."
	End If


dim d
d=date()
'response.write(d)

Function  max(maxs)
	dim msql,mrec
	msql="select max(" & maxs & ") as idmax from file"
	set mrec=con.execute(msql)
	if not mrec.EOF then
		max=mrec.fields("idmax").value
	end if
End Function

dim idm,maxs
maxs="fi_id"
idm=max(maxs)+1

dim usel,urec
usel="select * from officer where of_username='" & Session("user") & "' "
set urec=con.execute(usel)
if not urec.EOF then
	user=urec.fields("of_username").value
end if


dim insql,inrec
insql="insert into file values ('" & idm & "','" &  mySmartUpload.files("file1").filename & "','" & d & "','" & Session("user") & "')"
set inrec=con.Execute(insql)

Response.write("<script>window.close();</script>")

%>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-23 12:49:52 By : Clamore
 

 

No. 3

Guest


response.write("<script language='JavaScript'>")
response.write("alert('อัพโหลด เสร็จสิ้น');")
response.write("window.opener.document.getElementById('hidefile1').value='"&user&"';")
response.write("window.close();")
response.write("</script>")


เอาไว้แทน

Response.write("<script>window.close();</script>")


ลองดูครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-23 13:02:37 By : Thep
 


 

No. 4



โพสกระทู้ ( 297 )
บทความ ( 0 )



สถานะออฟไลน์


เออเรอบรรทัดที่ 11 ครับ ในส่วนของหน้า POPUP2 ครับ
มันแจ้งว่า
Request object error 'ASP 0104 : 80004005'

Operation not Allowed

/test/user/uploads1.asp, line 11
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-23 13:06:06 By : Clamore
 


 

No. 5

Guest


ถ้าใส่

Response.write("<script>window.close();</script>")

เหมือนเดิม Error หรือเปล่า ?
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-23 13:16:09 By : Thep
 


 

No. 6



โพสกระทู้ ( 297 )
บทความ ( 0 )



สถานะออฟไลน์


ตอนแรกไม่เออเรอครับ
แต่ตอนนี้เออเรอหมดเลยของหน้า POPUP2 เอาresponse ออกก็เออเรออ่ะ
เป็นที่อะไรอีกอ่ะเนี่ย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-23 13:25:28 By : Clamore
 


 

No. 7



โพสกระทู้ ( 297 )
บทความ ( 0 )



สถานะออฟไลน์


ผมแก้ปัญหาของ Operation no Allowed ได้แล้ว
แต่ script ที่ให้มาก็ไม่ติดอยู่ดีอ่ะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-23 14:15:39 By : Clamore
 


 

No. 8

Guest


ลองแบบนี้ครับ

1.
ใส่
Response.redirect "uploads.asp?Val=ตัวแปลเข้าไป

แทน

Response.write("<script>window.close();</script>")


แล้วใน uploads.asp

2.
<body onload="fncClose('<%=request("Val")%>');">

3.
สร้าง javascript

function fncClose(_val){
if(_val != ""){
window.opener.document.getElementById('hidefile1').value = _val;
window.close();
}

}
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-24 12:58:17 By : Thep
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ถ้า insert จาก popup แล้วให้ไปแสดงค่าที่เมนูหลักต้องทำยังไง
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่