Home >Web Front-end >JS Tutorial >Form submission (insertion effect)javascript_javascript skills

Form submission (insertion effect)javascript_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:27:261091browse
Pictures and more
图片
卡通图标 
Picture Cartoon icon
[You can press Ctrl Enter to publish when finished] <script> var img_src=''; var ToAdd=''; function show_image(){ var num1=document.reply_form.first_num.value; var num2=document.reply_form.second_num.value; var num3=document.reply_form.third_num.value; var num=num1+num2+num3; if('000'==num){ document.getElementById('face_to_insert').innerHTML=''; img_src=''; }else{ img_src='http://icon.zol.com.cn/bbs/index2/faces/'+num+'.gif'; document.getElementById('face_to_insert').innerHTML="<img id='face_to_show' src='' alt="Form submission (insertion effect)javascript_javascript skills" >"; document.getElementById('face_to_show').src=img_src; } document.reply_form.content.focus(); } <P>function use_mine(itemid){ if(!itemid){ return; } var dir=Math.ceil(itemid/1000); img_src='http://img.zol.com.cn/bbs/little/l_'+dir+'/'+itemid+'.gif'; document.getElementById('face_to_insert').innerHTML="<img id='face_to_show' src='' alt="Form submission (insertion effect)javascript_javascript skills" >"; document.getElementById('face_to_show').src=img_src; } <P>function message(userid,messageid){ var tr; tr = 'http://v1.bbs.zol.com.cn/user/send_msg.php?userid=' + userid+'&messageid='+messageid; window.open(tr,'message','width=470,height=382'); } <P>function CopyRssUrl(url){ if(!url){ return; } window.clipboardData.setData('Text',url); alert('Rss地址已复制到剪贴版'); } <P>function add_hexun(){ t=document.title; u=location.href; e=document.selection?(document.selection.type!='None'?document.selection.createRange().text:''):(document.getSelection?document.getSelection():''); void(open('http://bookmark.hexun.com/post.aspx?title='+escape(t)+'&url='+escape(u)+'&excerpt='+escape(e),'HexunBookmark','scrollbars=no,width=600,height=450,left=80,top=80,status=no,resizable=yes')); document.getElementById('hexun_bookmark').src='http://v1.bbs.zol.com.cn/tips/hexun_bookmark.php'; } <P>function ckform(obj){ if(0==obj.content.value.length){ alert('内容不能空啊!'); obj.content.focus(); return false; } if(img_src){ ToAdd = " [IMG]"+img_src+"[/IMG]"; obj.content.value += ToAdd; } obj.submit_data.value='正在提交..'; obj.submit_data.disabled=true; return true; } function reply_this(nickname,userid,level,headpic){ document.location = '#top_reply'; var info_str='<img src="http://bbs.zol.com.cn/new/images/little/3189.gif" alt="">对 '; if(level){ info_str+='第'+level+'楼'; }else{ info_str+='楼主'; } info_str+=' '+nickname+' <img src="'+headpic+'" alt=""> 说:'; document.reply_form.reply_info.value=info_str; document.reply_form.reply_to_userid.value=userid; document.reply_form.content.focus(); } <P>//对于匿名发贴网友 回复定位到回复框 function sysauto_reply(){ document.location = '#top_reply'; document.reply_form.content.focus(); } <P>function ctlent(eventobject){ if(event.ctrlKey && window.event.keyCode==13){ if(img_src){ ToAdd = " [IMG]"+img_src+"[/IMG]"; document.reply_form.content.value += ToAdd; } if(ckform(document.reply_form)){ document.reply_form.submit(); document.reply_form.submit_data.disabled=true; } } } function setsuper(tr){ str = '['+ tr +']' + document.reply_form.content.value + '[/'+ tr +']'; document.reply_form.content.value = str; } function onsize(){ ToAdd = '[size='+document.reply_form.fbsize.value+']' + document.reply_form.content.value + '[/size]'; document.reply_form.content.value = ToAdd; } function readCookie(name){ var cookieValue = ''; var search = name + '='; if(document.cookie.length > 0) { offset = document.cookie.indexOf(search); if (offset != -1) { offset += search.length; end = document.cookie.indexOf(';', offset); if (end == -1) end = document.cookie.length; cookieValue = unescape(document.cookie.substring(offset, end)) } } return cookieValue; } <P>function writeCookie(name, value, hours){ var expire = ''; if(hours != null) { expire = new Date((new Date()).getTime() + hours * 3600000); expire = '; expires=' + expire.toGMTString(); } document.cookie = name + '=' + escape(value) + expire; } <P>function Cimage(){ var enterURL = prompt("请输入图片网址", "http://"); if (enterURL){ ToAdd = " [URL=http://v1.bbs.zol.com.cn/tips/show_linkpic.php?piclink="+enterURL+"][IMG]"+enterURL+"[/IMG][/URL]"; } if(ToAdd){ document.reply_form.content.value += ToAdd; } } <P>function Cswf(){ var enterSIZE = prompt("输入Flash尺寸(宽,高)!", "WIDTH=300 HEIGHT=250"); var enterURL = prompt("请输入Flash网址", "http://"); if (enterURL) { ToAdd = "[FLASH]"+enterURL+" "+enterSIZE+"[/FLASH]"; } if(ToAdd){ document.reply_form.content.value += ToAdd; }else{ return; } } <P>function Curl(){ var FoundErrors = ''; var enterURL = prompt("输入链接网址!", "http://"); var enterTxT = prompt("输入链接说明!", "说明"); if (!enterURL) { FoundErrors += "\n" + "链接网址不能为空"; } if (!enterTxT) { FoundErrors += "\n" + "链接说明不能为空"; } if (FoundErrors) { alert("错误!"+FoundErrors); return; } str = "[URL="+enterURL+"]"+enterTxT; document.reply_form.content.value += str; document.reply_form.content.value += "[/URL]"; } <P></script> [Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute ]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn