100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > Ajax提交留言并实时显示的js代码[修正版]_表单特效

Ajax提交留言并实时显示的js代码[修正版]_表单特效

时间:2023-12-03 06:14:35

相关推荐

Ajax提交留言并实时显示的js代码[修正版]_表单特效

web前端|js教程

提交留言,实时显示

web前端-js教程

学习Ajax提交的朋友,不妨参考一下吧,从中你会明白一些技巧吧。

因代码本身的问题,脚本之家已经修正,欢迎大家测试。

网站放图片源码,ubuntu搭建矿机,利用爬虫下载小说,php 正则 ^,讷河seo优化lzw

Ajax留言本

美团app源码,ubuntu 添加菜单,爬虫是仿生么,php与php异构,seo分词符号lzw

* { padding: 0; margin: 0; } li { list-style: none; } body { background: #f9f9f9; font-size: 14px; } #explain { height: 60px; border-bottom: 1px solid #999999; background: #eee; font-size: 14px; color: #666; text-align: center; line-height: 60px; } #explain a { color: #990000; font-weight: bold; text-decoration: none; border-bottom: 1px dotted #990000; } #explain a:hover { border-bottom: 2px solid #990000; } #explain strong { color: #990000; } #box { width: 450px; padding: 10px; border: 1px solid #ccc; background: #f4f4f4; margin: 10px auto; } #fill_in { margin-bottom: 10px; } #fill_in li { padding: 5px 0; } #fill_in .text { width: 380px; height: 30px; padding: 0 10px; border: 1px solid #ccc; line-height: 30px; font-size: 14px; font-family: arial; } #fill_in textarea { width: 380px; height: 100px; line-height: 20px; padding: 5px 10px; border: 1px solid #ccc; font-size: 14px; font-family: arial; overflow: auto; vertical-align: top; } #fill_in .btn { border: none; width: 100px; height: 30px; border: 1px solid #ccc; background: #fff; color: #666; font-size: 14px; position: relative; left: 42px; } #message_text { display: none; } #message_text h2 { font-size: 14px; padding: 6px 0 4px 10px; background: #ddd; border-bottom: 1px solid #ccc; } #message_text li { background: #f9f9f9; border-bottom: 1px solid #ccc; color: #666; overflow: hidden; } #message_text h3 { padding: 10px; font-size: 14px; line-height: 24px; } #message_text p { padding: 0 10px 10px; text-indent: 28px; line-height: 20px; }

var oBtn = null; var oForm = null; var oText = null; var oTextarea = null; var timer = null; var speed = 0; var oLi = null var oH3 = null; var oP = null; window.onload = function() { oBtn = document.getElementById(“btn”); oBtn.onclick = getValue; }; function getValue() { document.getElementById(“message_text”).style.display = “block”; oForm = document.getElementsByTagName(“form”)[0]; oText = document.getElementById(“text”); oTextarea = document.getElementsByTagName(“textarea”)[0]; oUl = document.getElementById(“message_text”).getElementsByTagName(“ul”)[0]; oForm.onsubmit = function(){ return false; }; if( oText.value == “” || oTextarea.value == “” ) { alert(“就二个框,你还不写全了啊?”); return; } oLi = document.createElement(“li”); oH3 = document.createElement(“h3”); oP = document.createElement(“p”); oH3.innerHTML = oText.value; oP.innerHTML = oTextarea.value; if(oUl.childNodes[0]) { oUl.insertBefore(oLi,oUl.childNodes[0]); } else { oUl.appendChild(oLi); } oLi.appendChild(oH3); oLi.appendChild(oP); oText.value = “”; oTextarea.value = “”; var h = oLi.offsetHeight; oLi.style.height = ‘0px’; if(timer) { clearInterval(timer); } timer = setInterval(“goTime(“+h+”)”, 35); goTime(h); } function goTime(target) { var top = oLi.offsetHeight; speed += 3; top += speed; if(top > target) { top = target; speed *= -0.7; } if(top===target && Math.abs(speed) < 3) { clearInterval(timer); timer = null; oLi.style.height = target + "px"; } oLi.style.height = top + "px"; }

爱码网站源码,vscode自身框架,ubuntu两个终端cd,tomcat挂在iis,sqlite解决svn出错,thymeleaf 分页插件,mvc页面跳转带前端框架,本溪有爬虫店吗,php curl 图片,域名seo优化,保险行业网站源码,网页的多级菜单,404 html 模板下载,娱乐程序广告lzw

不妨多提交几次留言试试看……

姓名:

内容:

显示留言

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。