
ดูภาพแล้ว ก็คงไม่ต้องอธิบายความหมายอะไร
เดือนหน้าก็วันแม่แล้ว
กลับบ้านไปให้หาแม่กันเถอะ
เขียนเรื่อยเปื่อย แว่นตาแฟชั่น กรอบแว่นสายตา แว่นตากันแดด กรอบแว่นสายตาแฟชั่น (แอบโฆษณา ^^)
$(function(){
var max_length=200; // กำหนดจำนวนตัวอักษร
$("#txtQuit").keyup(function(){ // เมื่อ textarea id เท่ากับ data มี event keyup
var this_length=max_length-$(this).val().length; // หาจำนวนตัวอักษรที่เหลือ
if(this_length<0){
$(this).val($(this).val().substr(0,200)); // แสดงตามจำนวนตัวอักษรที่กำหนด
}else{
$("#now_length").html("ตัวอักษรที่เหลือจะพิมพ์ได้ "+this_length+" ตัวอักษร");
// แสดงตัวอักษรที่เหลือ
}
});
});
'ที่ต้อง import เข้ามา
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.IO
Imports System.Web.UI.Page
Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("intranetConnectionString").ConnectionString)
'ฟังก์ชั่น replace ตัวอักษรที่ไม่ต้องการ
Function replacetext(ByVal str As String) As String
str = Trim(str).Replace("'", " ")
Return str
End Function
'เหตุการณ์เมื่อกดปุ่ม upload
Protected Sub btnaddnews_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnaddnews.Click
Dim stradd As String
Dim maxid As Integer
'ไฟล์อัพโหลด
If Not FileUpload1.PostedFile Is Nothing And FileUpload1.PostedFile.ContentLength > 0 Then
Dim fn As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)
Dim fs As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.ContentLength)
Dim ft As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.ContentType)
Dim ft4add As String
Select Case Trim(ft)
Case "gif"
ft4add = "image/gif"
Case "pjpeg", "jpeg", "jpe", "jpg"
ft4add = "image/jpeg"
Case "png"
ft4add = "image/png"
Case Else
lblneedfile.Text = "ชนิดของรูปภาพไม่ถูกต้อง"
Exit Sub
End Select
Dim da As New SqlDataAdapter("select max(id_know) as maxx from tblKnowledge", conn)
Dim dt As New DataTable
da.Fill(dt)
If dt.Rows.Count <> 0 Then
maxid = CInt(dt.Rows(0).Item("maxx")) + 1
Else
maxid = 0
End If
stradd = "INSERT INTO tblKnowledge(id_know,FileName,FileSize,FileData,ContentType,topic,detail1,detail2,detail3,detail4,detail5,dateadd,addby,foot)"
stradd += " VALUES('" & maxid & "','" & fn & "','" & fs & "', @filedata ,'" & ft4add & "','" & replacetext(txttopic.Text) & "','" & replacetext(txtdetail1.Text) & "','" & replacetext(txtdetail2.Text) & "','" & replacetext(txtdetail3.Text) & "','" & replacetext(txtdetail4.Text) & "','" & replacetext(txtdetail5.Text) & "','" & Date.Now & "','" & CStr(Session("adminUser")) & "','" & replacetext(txtfrom.Text) & "')"
Dim myCommand As New SqlCommand(stradd, conn)
Dim imageBytes(System.IO.Path.GetFileName(FileUpload1.PostedFile.InputStream.Length)) As Byte
System.IO.Path.GetFileName(FileUpload1.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length))
myCommand.Parameters.AddWithValue("@filedata", imageBytes)
conn.Open()
myCommand.ExecuteNonQuery()
conn.Close()
Response.Redirect("index.aspx")
End If
End Sub
'ไฟล์แสดงรูป สมมุติว่าชื่อ formShowPic.aspx
If Not Page.IsPostBack Then
Dim cashowpic As New SqlDataAdapter("select FileData,ContentType from tblKnowledge where id_know='" & Trim(Request.QueryString("idpic")) & "'", conn)
Dim dtshowpic As New DataTable
cashowpic.Fill(dtshowpic)
If dtshowpic.Rows.Count <> 0 Then
If Not IsDBNull(dtshowpic.Rows(0).Item("FileData")) Then
Dim dataFromDtb As Byte() = DirectCast(dtshowpic.Rows(0).Item("FileData"), Byte())
Response.Clear()
Response.ContentType = Trim(dtshowpic.Rows(0).Item("ContentType").ToString)
Response.BinaryWrite(dataFromDtb)
Response.End()
End If
End If
End If
im1.ImageUrl = "formShowPic.aspx?idpic=" & Trim(dtedit.Rows(0).Item("id_know").ToString)
PopBox is an image magnification javascript solution for dynamically moving and resizing images on your web page. Javascript? Yes - I know it's nothing new and that you've been able to move and resize things in Javascript for years, but only now is there a prepackaged solution that makes it as easy as 3 lines of HTML without knowing a lick about positioning!
Main Features