jquery中append,prepend,before和after方法的区别是什么?

html-css016

jquery中append,prepend,before和after方法的区别是什么?,第1张

pend:在元素内部的最后面添加元素,作为子元素,如:

通过jquery代码$("div").append("<p>我是通过append添加的</p>"),得到的结果是:

prepend:在元素内部的最前面添加元素,作为子元素,如:

通过jquery代码$("div").prepend("<p>我是通过prepend添加的</p>"),得到的结果是:

before:在元素的前边,作为兄弟元素添加,如:

通过jquery代码 $(".base").before("<div>我是在前边添加的兄弟节点</div>"),得到的结果是:

after:在元素的后边,作为兄弟元素添加,如:

通过jquery代码 $(".base").after("<div>我是在后边添加的兄弟节点</div>"),得到的结果是:

jQuery是一个快速、简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库( 或JavaScript框架)。

jQuery设计的宗旨是“write Less,Do More”,即倡导写更少的代码,做更多的事情。

它封装JavaScript常用的功能代码,提供一种简便的JavaScript设计模式,优化HTML文档操作、事件处理、动画设计和Ajax交互。

jQuery的模块可以分为:入口模块、底层支持模块和功能模块。

其核心特性可以总结为:具有独特的链式语法和短小清晰的多功能接口;具有高效灵活的css选择器,并且可对CSS选择器进行扩展;拥有便捷的插件扩展机制和丰富的插件。

jQuery兼容各种主流浏览器,如IE 6.0+、FF 1.5+、Safari 2.0+、Opera 9.0+等。

适用于:

Oracle Server - Enterprise Edition - Version 11.2.0.2 and later

Information in this document applies to any platform.

目的:

Rebootless Fencing 是从11.2.0.2引入的新特性,当evict 发生时,Rebootless Fencing 取代了

11.2.0.2之前的reboot 节点。Rebootless Fencing 会尝试在被驱逐的节点上 gracefully 停止 GI

以避免reboot节点。

若是Rebootless Fencing 失败了,被驱逐的节点会被reboot。本文列示了Rebootless Fencing 失败的通常原因。

细节:

1. Resources fails to stop.

If one or more resources fail to stop, rebootless fencing will fail and node will be rebooted.

In this case, rebootless fencing fails on node2 after network split brain and node 2 is rebooted as expected:

?/log//alert.log from evicted node:

.. 2012-09-11 12:04:34.363[cssd(18834)]CRS-1610:Network communication with node racnode1 (1) missing for 90% of timeout interval. Removal of this node from cluster in 2.020 seconds2012-09-11 12:04:36.379[cssd(18834)]CRS-1609:This node is unable to communicate with other nodes in the cluster and is going down to preserve cluster integritydetails at (:CSSNM00008:) in /ocw/grid/log/racnode2/cssd/ocssd.log.2012-09-11 12:04:36.379[cssd(18834)]CRS-1656:The CSS daemon is terminating due to a fatal errorDetails at (:CSSSC00012:) in /ocw/grid/log/racnode2/cssd/ocssd.log2012-09-11 12:04:36.399[cssd(18834)]CRS-1652:Starting clean up of CRSD resources.2012-09-11 12:04:36.586[crsd(26115)]CRS-5833:Cleaning resource 'zDRMON.sh.racnode2 1 1' failed as part of reboot-less node fencing2012-09-11 12:04:36.588[cssd(18834)]CRS-1653:The clean up of the CRSD resources failed.##>>user resource fails to be cleaned2012-09-11 12:04:37.042[ohasd(16821)]CRS-2765:Resource 'ora.evmd' has failed on server 'racnode2'.2012-09-11 12:04:37.052[/ocw/grid/bin/scriptagent.bin(27696)]CRS-5822:Agent '/ocw/grid/bin/scriptagent_oracle' disconnected from server. Details at (:CRSAGF00117:) {0:4:10} in /ocw/grid/log/racnode2/agent/crsd/scriptagent_oracle/scriptagent_oracle.log.2012-09-11 12:04:37.062[ohasd(16821)]CRS-2765:Resource 'ora.crsd' has failed on server 'racnode2'. ##>>node rebooted after this message, in some cases, this message won't be there2012-09-11 12:10:47.356[ohasd(16677)]CRS-2112:The OLR service started on node racnode2.2012-09-11 12:10:47.521[ohasd(16677)]CRS-1301:Oracle High Availability Service started on node racnode2.2012-09-11 12:10:47.539[ohasd(16677)]CRS-8011:reboot advisory message from host: racnode2, component: cssagent, with time stamp: L-2012-09-11-12:04:37.140 ##>>reboot advisory shows both cssdagent and cssdmonitor took the action to reboot[ohasd(16677)]CRS-8013:reboot advisory message text: clsnomon_status: need to reboot, unexpected failure 8 received from CSS2012-09-11 12:10:47.594[ohasd(16677)]CRS-8011:reboot advisory message from host: racnode2, component: cssmonit, with time stamp: L-2012-09-11-12:04:37.139[ohasd(16677)]CRS-8013:reboot advisory message text: clsnomon_status: need to reboot, unexpected failure 8 received from CSS2012-09-11 12:10:47.605[ohasd(16677)]CRS-8017:location: /etc/oracle/lastgasp has 2 reboot advisory log files, 2 were announced and 0 errors occurred

When resource fails to stop, cssdagent or cssdmonitor or both will try to reboot the node, below is sample log.

?/agent/ohasd/oracssdmonitor_root/oracssdmonitor_root.log

2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnpollmsg_main: got posted

2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnpollmsg_main: shutdown initiated by CSS, requested to sync

2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnwork_queue: posting worker thread

2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnpollmsg_main: exiting check loop

2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnpollmsg_main: got HB signal

2012-09-11 12:04:36.400: [ USRTHRD][1097382208] clsnwork_process_work: calling sync

2012-09-11 12:04:36.413: [ USRTHRD][1097382208] clsnwork_process_work: sync completed

2012-09-11 12:04:37.035: [ CSSCLNT][1095805248]clsssRecvMsg: got a

disconnect from the server while waiting for message type 22

2012-09-11 12:04:37.035: [ CSSCLNT][1098959168]clsssRecvMsg: got a

disconnect from the server while waiting for message type 27

2012-09-11 12:04:37.035: [ USRTHRD][1095805248] clsnwork_queue: posting worker thread

2012-09-11 12:04:37.035: [ USRTHRD][1095805248] clsnpollmsg_main: exiting check loop

2012-09-11 12:04:37.035: [GIPCXCPT][1098959168]gipcInternalSend:

connection not valid for send operation endp 0x8e3e60 [00000000000001b7]

{ gipcEndpoint : localAddr

'clsc://(ADDRESS=(PROTOCOL=ipc)(KEY=)(GIPCID=3165a05b-7e7139a5-18801))',

remoteAddr

'clsc://(ADDRESS=(PROTOCOL=ipc)(KEY=OCSSD_LL_racnode2_)(GIPCID=7e7139a5-3165a05b-18834))',

numPend 0, numReady 0, numDone 0, numDead 0, numTransfer 0, objFlags

0x0, pidPeer 18834, flags 0x3861e, usrFlags 0x20010 }, ret

gipcretConnectionLost (12)

2012-09-11 12:04:37.035: [ USRTHRD][1097382208] clsnwork_process_work: calling sync

2012-09-11 12:04:37.035: [ CSSCLNT][1077418304]clsssRecvMsg: got a

disconnect from the server while waiting for message type 1

2012-09-11 12:04:37.036: [ CSSCLNT][1077418304]clssgsGroupGetStatus: communications failed (0/3/-1)

2012-09-11 12:04:37.036: [ CSSCLNT][1077418304]clssgsGroupGetStatus: returning 8

2012-09-11 12:04:37.036: [ USRTHRD][1077418304] clsnomon_status:

Communications failure with CSS detected. Waiting for sync to

complete...

2012-09-11 12:04:37.036:

[GIPCXCPT][1098959168]gipcSendSyncF [clsssServerRPC : clsss.c : 6272]:

EXCEPTION[ ret gipcretConnectionLost (12) ] failed to send on endp

0x8e3e60 [00000000000001b7] { gipcEndpoint : localAddr

'clsc://(ADDRESS=(PROTOCOL=ipc)(KEY=)(GIPCID=3165a05b-7e7139a5-18801))',

remoteAddr

'clsc://(ADDRESS=(PROTOCOL=ipc)(KEY=OCSSD_LL_racnode2_)(GIPCID=7e7139a5-3165a05b-18834))',

numPend 0, numReady 0, numDone 0, numDead 0, numTransfer 0, objFlags

0x0, pidPeer 18834, flags 0x3861e, usrFlags 0x20010 }, addr

0000000000000000, buf 0x4180bd80, len 80, flags 0x8000000

2012-09-11 12:04:37.036: [ CSSCLNT][1098959168]clsssServerRPC: send failed with err 12, msg type 7

2012-09-11 12:04:37.036: [ CSSCLNT][1098959168]clsssCommonClientExit: RPC failure, rc 3

2012-09-11 12:04:37.139: [ USRTHRD][1097382208] clsnwork_process_work: sync completed

2012-09-11 12:04:37.139: [ USRTHRD][1097382208] clsnSyncComplete: posting omon

?/agent/ohasd/oracssdagent_root/oracssdagent_root.log

2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnpollmsg_main: got posted2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnpollmsg_main: shutdown initiated by CSS, requested to sync2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnwork_queue: posting worker thread2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnpollmsg_main: exiting check loop2012-09-11 12:04:36.400: [ USRTHRD][1095805248] clsnpollmsg_main: got HB signal2012-09-11 12:04:36.400: [ USRTHRD][1097382208] clsnwork_process_work: calling sync2012-09-11 12:04:36.413: [ USRTHRD][1097382208] clsnwork_process_work: sync completed2012-09-11 12:04:37.035: [ CSSCLNT][1098959168]clsssRecvMsg: got a disconnect from the server while waiting for message type 272012-09-11 12:04:37.035: [ CSSCLNT][1095805248]clsssRecvMsg: got a disconnect from the server while waiting for message type 222012-09-11 12:04:37.035: [GIPCXCPT][1098959168]gipcInternalSend: connection not valid for send operation endp 0x2aaab4014900 [00000000000001c0] { gipcEndpoint : localAddr 'clsc://(ADDRESS=(PROTOCOL=ipc)(KEY=)(GIPCID=561e3f6b-a0a3602e-18817))', remoteAddr 'clsc://(ADDRESS=(PROTOCOL=ipc)(KEY=OCSSD_LL_racnode2_)(GIPCID=a0a3602e-561e3f6b-18834))', numPend 0, numReady 0, numDone 0, numDead 0, numTransfer 0, objFlags 0x0, pidPeer 18834, flags 0x3861e, usrFlags 0x20010 }, ret gipcretConnectionLost (12)2012-09-11 12:04:37.035: [ USRTHRD][1095805248] clsnwork_queue: posting worker thread2012-09-11 12:04:37.035: [ USRTHRD][1095805248] clsnpollmsg_main: exiting check loop2012-09-11 12:04:37.035: [GIPCXCPT][1098959168]gipcSendSyncF [clsssServerRPC : clsss.c : 6272]: EXCEPTION[ ret gipcretConnectionLost (12) ] failed to send on endp 0x2aaab4014900 [00000000000001c0] { gipcEndpoint : localAddr 'clsc://(ADDRESS=(PROTOCOL=ipc)(KEY=)(GIPCID=561e3f6b-a0a3602e-18817))', remoteAddr 'clsc://(ADDRESS=(PROTOCOL=ipc)(KEY=OCSSD_LL_racnode2_)(GIPCID=a0a3602e-561e3f6b-18834))', numPend 0, numReady 0, numDone 0, numDead 0, numTransfer 0, objFlags 0x0, pidPeer 18834, flags 0x3861e, usrFlags 0x20010 }, addr 0000000000000000, buf 0x4180bd80, len 80, flags 0x80000002012-09-11 12:04:37.035: [ CSSCLNT][1098959168]clsssServerRPC: send failed with err 12, msg type 7 2012-09-11 12:04:37.035: [ CSSCLNT][1098959168]clsssCommonClientExit: RPC failure, rc 32012-09-11 12:04:37.036: [ CSSCLNT][1077418304]clsssRecvMsg: got a disconnect from the server while waiting for message type 12012-09-11 12:04:37.036: [ CSSCLNT][1077418304]clssgsGroupGetStatus: communications failed (0/3/-1)2012-09-11 12:04:37.036: [ CSSCLNT][1077418304]clssgsGroupGetStatus: returning 82012-09-11 12:04:37.036: [ USRTHRD][1077418304] clsnomon_status: Communications failure with CSS detected. Waiting for sync to complete...2012-09-11 12:04:37.036: [ USRTHRD][1097382208] clsnwork_process_work: calling sync

As CRSD resources (user resources) failed to stop, crsd.log can be a starting point for further debugging.

需要三个文件:

第一个(upload.asp)

<% Response.Buffer=True %>

<html>

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">

<title>图片上传</title>

</head>

<body background="images/bg.gif" topmargin="30" style=""><div align="center">

<center>

<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" width="420" id="AutoNumber69" bgcolor="#F5F5F5">

<tr>

<td width="100%" bgcolor="#F5F5F5" bordercolor="#F5F5F5"><form name="form1" method="post" action="uploadsave.asp" enctype="multipart/form-data">

<p align="center"><span style="font-size: 12px">图片上传:</span><br>

<br>

 

<input type="file" class="f11" name="file1" size="23">

<br>

<br>

<input type=submit name="submit" value="上 传" class=anniu >

<br>

<br>

<span style="font-size: 12px">文件格式为<font color="#EC5106">*.gif,*.jpg,*.jpeg

</font></span></p>

</form></td>

</tr>

</table>

</center>

</body>

</html>

第二个文件(uploadsave.asp)

<% Response.Buffer=True %>

<html>

<!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/htmlcharset=gb2312" />

<title>图片上传</title>

</head>

<body topmargin="20">

<!--#include FILE="upload_asjob.asp"-->

<%

set upload=new upload_5xsoft

set file=upload.file("file1")

if file.fileSize>0 then

'自动生成文件名

filename=date()

filename=filename&time()

filename=replace(filename,"-","")

filename=replace(filename,":","")

filename=replace(filename," ","")

filename=filename+"."

filenameend=file.filename

filenameend=split(filenameend,".")

if filenameend(1)="gif" or filenameend(1)="jpg" or filenameend(1)="jpeg" then

filename=filename&filenameend(1)

file.saveAs Server.mappath("uppic/"&filename)

response.write "<p align=center>"

response.write "图片已成功上传至服务器中,请使用下面红色地址添加图片,<br><p align=center><a href=upload.asp>点击这里重新上传图片!</a>"

response.write "</p>"

response.write "<p align=center>"

response.write "<font color=red>"

response.write "asjobcom/uppic/"&filename

response.write "</font></p>"

response.write "<p align=center>"

response.write "<a href='uppic/"&filename&"' target=_blank>点击这里查看上传的图片</a>"

response.write "</p>"

response.write "<p align=center><a href=javascript:window.close()>【关闭窗口】</a>"

else

response.write "文件格式不对"

response.write "<a href=upload.asp>返回"

end if

set file=nothing

else

response.write "文件内容不能为空"

response.write "<a href=upload.asp>返回"

end if

set upload=nothing

response.write "<br>"

%>

最后一个(upload_asjob.asp)

<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>

dim upfile_5xSoft_Stream

Class upload_5xSoft

dim Form,File,Version

Private Sub Class_Initialize

dim iStart,iFileNameStart,iFileNameEnd,iEnd,vbEnter,iFormStart,iFormEnd,theFile

dim strDiv,mFormName,mFormValue,mFileName,mFileSize,mFilePath,iDivLen,mStr

Version="化境编程界HTTP上传程序 Version 1.0"

if Request.TotalBytes<1 then Exit Sub

set Form=CreateObject("Scripting.Dictionary")

set File=CreateObject("Scripting.Dictionary")

set upfile_5xSoft_Stream=CreateObject("Adodb.Stream")

upfile_5xSoft_Stream.mode=3

upfile_5xSoft_Stream.type=1

upfile_5xSoft_Stream.open

upfile_5xSoft_Stream.write Request.BinaryRead(Request.TotalBytes)

vbEnter=Chr(13)&Chr(10)

iDivLen=inString(1,vbEnter)+1

strDiv=subString(1,iDivLen)

iFormStart=iDivLen

iFormEnd=inString(iformStart,strDiv)-1

while iFormStart <iFormEnd

iStart=inString(iFormStart,"name=""")

iEnd=inString(iStart+6,"""")

mFormName=subString(iStart+6,iEnd-iStart-6)

iFileNameStart=inString(iEnd+1,"filename=""")

if iFileNameStart>0 and iFileNameStart<iFormEnd then

iFileNameEnd=inString(iFileNameStart+10,"""")

mFileName=subString(iFileNameStart+10,iFileNameEnd-iFileNameStart-10)

iStart=inString(iFileNameEnd+1,vbEnter&vbEnter)

iEnd=inString(iStart+4,vbEnter&strDiv)

if iEnd>iStart then

mFileSize=iEnd-iStart-4

else

mFileSize=0

end if

set theFile=new FileInfo

theFile.FileName=getFileName(mFileName)

theFile.FilePath=getFilePath(mFileName)

theFile.FileSize=mFileSize

theFile.FileStart=iStart+4

theFile.FormName=FormName

file.add mFormName,theFile

else

iStart=inString(iEnd+1,vbEnter&vbEnter)

iEnd=inString(iStart+4,vbEnter&strDiv)

if iEnd>iStart then

mFormValue=subString(iStart+4,iEnd-iStart-4)

else

mFormValue=""

end if

form.Add mFormName,mFormValue

end if

iFormStart=iformEnd+iDivLen

iFormEnd=inString(iformStart,strDiv)-1

wend

End Sub

Private Function subString(theStart,theLen)

dim i,c,stemp

upfile_5xSoft_Stream.Position=theStart-1

stemp=""

for i=1 to theLen

if upfile_5xSoft_Stream.EOS then Exit for

c=ascB(upfile_5xSoft_Stream.Read(1))

If c >127 Then

if upfile_5xSoft_Stream.EOS then Exit for

stemp=stemp&Chr(AscW(ChrB(AscB(upfile_5xSoft_Stream.Read(1)))&ChrB(c)))

i=i+1

else

stemp=stemp&Chr(c)

End If

Next

subString=stemp

End function

Private Function inString(theStart,varStr)

dim i,j,bt,theLen,str

InString=0

Str=toByte(varStr)

theLen=LenB(Str)

for i=theStart to upfile_5xSoft_Stream.Size-theLen

if i>upfile_5xSoft_Stream.size then exit Function

upfile_5xSoft_Stream.Position=i-1

if AscB(upfile_5xSoft_Stream.Read(1))=AscB(midB(Str,1)) then

InString=i

for j=2 to theLen

if upfile_5xSoft_Stream.EOS then

inString=0

Exit for

end if

if AscB(upfile_5xSoft_Stream.Read(1))<>AscB(MidB(Str,j,1)) then

InString=0

Exit For

end if

next

if InString<>0 then Exit Function

end if

next

End Function

Private Sub Class_Terminate

form.RemoveAll

file.RemoveAll

set form=nothing

set file=nothing

upfile_5xSoft_Stream.close

set upfile_5xSoft_Stream=nothing

End Sub

Private function GetFilePath(FullPath)

If FullPath <>"" Then

GetFilePath = left(FullPath,InStrRev(FullPath, "\"))

Else

GetFilePath = ""

End If

End function

Private function GetFileName(FullPath)

If FullPath <>"" Then

GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)

Else

GetFileName = ""

End If

End function

Private function toByte(Str)

dim i,iCode,c,iLow,iHigh

toByte=""

For i=1 To Len(Str)

c=mid(Str,i,1)

iCode =Asc(c)

If iCode<0 Then iCode = iCode + 65535

If iCode>255 Then

iLow = Left(Hex(Asc(c)),2)

iHigh =Right(Hex(Asc(c)),2)

toByte = toByte &chrB("&H"&iLow) &chrB("&H"&iHigh)

Else

toByte = toByte &chrB(AscB(c))

End If

Next

End function

End Class

Class FileInfo

dim FormName,FileName,FilePath,FileSize,FileStart

Private Sub Class_Initialize

FileName = ""

FilePath = ""

FileSize = 0

FileStart= 0

FormName = ""

End Sub

Public function SaveAs(FullPath)

dim dr,ErrorChar,i

SaveAs=1

if trim(fullpath)="" or FileSize=0 or FileStart=0 or FileName="" then exit function

if FileStart=0 or right(fullpath,1)="/" then exit function

set dr=CreateObject("Adodb.Stream")

dr.Mode=3

dr.Type=1

dr.Open

upfile_5xSoft_Stream.position=FileStart-1

upfile_5xSoft_Stream.copyto dr,FileSize

dr.SaveToFile FullPath,2

dr.Close

set dr=nothing

SaveAs=0

end function

End Class

</SCRIPT>