var i=settime.indexOf(':') //如果settime包含":" 则 i 返回":"在settime里面的位置,否则返回-1
<script type="text/javascript">var n=0
function addfile(){
var where="beforeend"
var str=''//元素
var el=document.getElementById('div的id')
where = where.toLowerCase()
if(el.insertAdjacentHTML){
switch(where){
case "beforeend":
el.insertAdjacentHTML('BeforeEnd', str)
return el.lastChild
}
throw 'Illegal insertion point ->"' + where + '"'
}
var range = el.ownerDocument.createRange()
var frag
switch(where){
case "beforeend":
if(el.lastChild){
range.setStartAfter(el.lastChild)
frag = range.createContextualFragment(str)
el.appendChild(frag)
return el.lastChild
}else{
el.innerHTML = str
return el.lastChild
}
}
throw 'Illegal insertion point ->"' + where + '"'
}
</script>
我这个只是一部分,完整的可以再<div id="qwrdg"> </div>任意部分添加