html按钮源码
‘壹’ HTML中怎么设置按钮的大小
html中设置按钮的大小:可直接给input元素添加宽、高,具体代码如下:
<input type="submit" value="确定" style="width:100px;height:60px">
下面是未设置input按钮大小和设置了按钮大小的对比效果:
源代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>input</title>
<style type="text/css">
body{background: #ddd;}
form{margin:0;padding:0;}
form .btn{
width:100px;
height: 40px;
}
</style>
</head>
<body>
<input type="submit" value="确定" style="width:100px;height:60px;">
<input type="submit" value="确定" style="width:100px;height:100px">
<input type="submit" value="确定" >
<form action="form_action.asp" method="get">
<p>Email: <input type="text" name="email" /></p>
<p>Pin: <input type="text" name="pin" maxlength="18" /></p>
<input type="submit" value="提交" class="btn" />
</form>
</body>
</html>
‘贰’ html源码是什么
html源码是什么就是用html语言写的什么标签,样式、js之类的计算机代码(网页的),
如:在后缀问。html的文件中用记事本打开输入<input type="button" value="123"> 保存,在用浏览器打开,会显示一个123的按钮!
上面的 <input type="button" value="123">就是一段html源码
‘叁’ 怎么运行 html5游戏的源代码
1、打开任意一个网站,根据自己的需要选择。
‘肆’ Struts源码研究 - html-Link标签篇
Struts里的:Cancel标签是在Form中经常运用的一个标签 主要功能就是cancel当前Form 一般写法如下 ===========================<:cancel><bean:message key= createuser cancelbutton /></:cancel>===========================这个标签将生成如下的HTML代码 <input type= submit name= apacl CANCEL value= 返回 onclick= bCancel=true; >bCancel=true是一段javascript bCancel是在使用Struts的Validator时 Struts自动为我们加的一段Javascript代码里的一个变量这段Javascript简略摘要如下 ===========================<script type= text/javascript language= Javascript ><! Beginvar bCancel = false;function validateCreateUserForm(form) {if (bCancel)return true;elsereturn validateMaxLength(form) && validateRequired(form) && validateMinLength(form);}===========================由上可以看到 这个bCancel=true时 Javascript将自动将表单提交(return true) 也就是说 如果我们在后台Action的代码里没有对这个Cancel动作写特定代码的话 这个Cancel标签产生的效果和submit按钮产生的动作完全一致!!(因为这个按钮的type也等于submit)这一点需要非常的注意!所以 一般来说 我们在Action类的execute方法里面会加上如下的一段代码来处理这个Cancel动作 ===========================// Was this transaction cancelled?if (isCancelled(request)) {return (mapping findForward( createusersuccess ));}===========================有了以上的代码 Cancel动作就有了相应的处理代码 转到相关的页面了 本来事情已经解决 但本着对Struts源码研究的精神 我们还需要对以上代码研究一下OK 让我们来看一下isCancelled这个方法在什么地方被定义了 内容是什么?首先发现 这个方法被定义在Action类里面 代码如下 ===========================/*** <p>Returns <code>true</code> if the current form s cancel button was* pressed This method will check if the <code>Globals CANCEL_KEY</code>* request attribute has been set which normally occurs if the cancel* button generated by <strong>CancelTag</strong> was pressed by the user* in the current request If <code>true</code> validation performed* by an <strong>ActionForm</strong> s <code>validate()</code> method* will have been skipped by the controller servlet </p>** @param request The servlet request we are processing* @see apacl CancelTag*/protected boolean isCancelled(HttpServletRequest request) {return (request getAttribute(Globals CANCEL_KEY) != null);}===========================哦 原来是在request对象中查找Globals CANCEL_KEY这个key值是否绑定了一个对象 如果是 那么就代表按下Cancel按钮后 Struts会在request对象中绑定一个对象 并以这个key值来命名那Struts是在什么地方绑定了这个对象呢?很自然的 让我们从头找起从ActionServlet的process方法开始找起 历经多次方法调用 终于找到了根源 原来是在RequestProcessor java中 代码如下 ===========================/*** <p>Process an <code>HttpServletRequest</code> and create the* corresponding <code>HttpServletResponse</code> </p>** @param request The servlet request we are processing* @param response The servlet response we are creating** @exception IOException if an input/output error occurs* @exception ServletException if a processing exception occurs*/public void process(HttpServletRequest request HttpServletResponse response)throws IOException ServletException {//省略代码若干// Process any ActionForm bean related to this requestActionForm form = processActionForm(request response mapping);//答案就在这个processPopulate方法中processPopulate(request response form mapping);if (!processValidate(request response form mapping)) {return;}/*** Populate the properties of the specified ActionForm instance from* the request parameters included with this request In addition * request attribute <code>Globals CANCEL_KEY</code> will be set if* the request was submitted with a button created by* <code>CancelTag</code> ** @param request The servlet request we are processing* @param response The servlet response we are creating* @param form The ActionForm instance we are populating* @param mapping The ActionMapping we are using** @exception ServletException if thrown by RequestUtils populate()*/protected void processPopulate(HttpServletRequest request HttpServletResponse response ActionForm form ActionMapping mapping)throws ServletException {if (form == null) {return;}// Populate the bean properties of this ActionForm instanceif (log isDebugEnabled()) {log debug( Populating bean properties from this request );}form setServlet(this servlet);form reset(mapping request);if (mapping getMultipartClass() != null) {request setAttribute(Globals MULTIPART_KEY mapping getMultipartClass());}RequestUtils populate(form mapping getPrefix() mapping getSuffix() request);// Set the cancellation request attribute if appropriateif ((request getParameter(Constants CANCEL_PROPERTY) != null) ||(request getParameter(Constants CANCEL_PROPERTY_X) != null)) {request setAttribute(Globals CANCEL_KEY Boolean TRUE);}}===========================OK 看最后几行代码 Struts从request中取得Constants CANCEL_PROPERTY这个参数 如果这个参数不为空 那么他就将TRUE这个对象以Globals CANCEL_KEY为key值 放到了request对象中至于这个Constants CANCEL_PROPERTY这个值是什么 现在都可以猜到了 显然就是:Cancel这个标签生成的HTML代码中 Cancel这个按钮的名称嘛!查了一下 果然是 <input type= submit name= apacl CANCEL value= 返回 onclick= bCancel=true; >而Constants CANCEL_PROPERTY这个值就是 apacl CANCEL lishixin/Article/program/Java/ky/201311/28930
‘伍’ 帮忙写个HTML网页按钮代码
<!doctypehtml>
<metacharset="utf-8"/>
<html>
<head>
<styletype="text/css">
html,body{
height:100%;
margin:0;
background:#EEEEEE;
position:relative;
}
button{
position:absolute;
top:50%;
left:50%;
width:400px;
height:100px;
margin:-50px-200px;
background:#ffffff;
font:72px"MicrosoftYaHei";
color:blue;
}
button:hover{
background:#eeeeff;
}
</style>
</head>
<body>
<buttononclick="location.href='#someplace'">进入BBS</button>
</body>
</html>
‘陆’ 用html如何实现点击按钮变换按钮的样式
html页面如下:
<divclass="wrapper">
<divid="focus">
<ul>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/01.jpg"alt="QQ商城焦点图效果下载"/></a></li>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/02.jpg"alt="QQ商城焦点图效果教程"/></a></li>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/03.jpg"alt="jquery商城焦点图效果"/></a></li>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/04.jpg"alt="jquery商城焦点图代码"/></a></li>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/05.jpg"alt="jquery商城焦点图源码"/></a></li>
</ul>
</div>
</div><!--wrapperend-->
</body>
css样式:
<styletype="text/css">
*{margin:0;padding:0;}
body{font-size:12px;color:#222;font-family:Verdana,Arial,Helvetica,sans-serif;background:#f0f0f0;}
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
.clearfix{zoom:1;}
ul,li{list-style:none;}
img{border:0;}
.wrapper{width:800px;margin:0auto;padding-bottom:50px;}
/*qqshopfocus*/
#focus{width:800px;height:280px;overflow:hidden;position:relative;}
#focusul{height:380px;position:absolute;}
#focusulli{float:left;width:800px;height:280px;overflow:hidden;position:relative;background:#000;}
#focusullidiv{position:absolute;overflow:hidden;}
#focus.btnBg{position:absolute;width:800px;height:20px;left:0;bottom:0;background:#000;}
#focus.btn{position:absolute;width:780px;height:10px;padding:5px10px;right:0;bottom:0;text-align:right;}
#focus.btnspan{display:inline-block;_display:inline;_zoom:1;width:25px;height:10px;_font-size:0;margin-left:5px;cursor:pointer;background:#fff;}
#focus.btnspan.on{background:#fff;}
#focus.preNext{width:45px;height:100px;position:absolute;top:90px;background:url(img/sprite.png)no-repeat00;cursor:pointer;}
#focus.pre{left:0;}
#focus.next{right:0;background-position:righttop;}
</style>
‘柒’ 网页设计常用HTML代码
网页设计常用HTML代码大全
HTML是用来描述网页的一种语言。下面我为大家分享HTML代码,希望对大家学习html代码有帮助!
忽视右键
<body oncontextmenu="return false">
或
<body style="overflow-y:hidden">
1.如何几秒后转到别的页面?
<META HTTP-EQUIV="Refresh" CONTENT="时间;URL=地址">
2.点击关闭窗口
<a href="javascript:top.window.close();">点击关闭窗口</a>!
3.请问如何去掉主页右面的滚动条?
<body scroll="no">
<body style="overflow-y:hidden">
4.请问如何做到让一个网页自动关闭.
<html>
<head>
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
</head>
<body onload="window.setTimeout(‘‘‘‘closes.Click()‘‘‘‘,10000)">
这个窗口会在10秒过后自动关闭,而且不会出现提示. </body>
如何在不刷新页面的情况下刷新css?
<style>
button{ color:#000000;}
</style>
<button onclick=document.styleSheets[0].rules[0].style.color=‘‘‘‘red‘‘‘‘>点击按钮直接修改style标签里button选择符使按钮改为红色</button>
请问如何让网页自动刷新?
在head部记入<META HTTP-EQUIV="Refresh" content="20">其中20为20秒后自动刷新,你可以更改为任意值。
5.如何让页面自动刷新?
方法一,用refresh
HTML 代码片段如下:
<head>
<meta http-equiv="refresh" content="5">
</head>
5表示刷新时间
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
方法二,使用setTimeout控制
<img src=/logo.gif>
<script>
function rl(){
document.location.reload()
}
setTimeout(rl,2000)
</script>
6.如何让超链接没有下划线
在源代码中的<HEAD>…</HEAD>之间输入如下代码:
<style type="text/css"> <!--
a { text-decoration: none}
--> </style>
7.请问如何去掉IE的上下滚动条?
<body style=‘‘‘‘overflow:scroll;overflow-y:hidden‘‘‘‘>
</body>
8.怎样才能把RealPlayer文件在网页做一个试听连接?
<embed height=25src=51js.rm type=audio/x-pn-realaudio-plugin width=50 autostart="false" controls="PlayButton">
9.如何用html实现浏览器上后退按钮的功能?
<a href="java script:history.go(-1)">点击后退</a>
或者
<script> history.back() </script>
10.请问怎么在网页中改变鼠标的箭头形状?
HTML 代码片段如下:
<body>
<a href="#" style="cursor: auto;">auto</a><br>
<a href="#" style="cursor: crosshair ">crosshair </a><br>
<a href="#" style="cursor: default ">default </a><br>
<a href="#" style="cursor: hand ">hand </a><br>
<a href="#" style="cursor: move ">move </a><br>
<a href="#" style="cursor: e-resize ">e-resize </a><br>
<a href="#" style="cursor: ne-resize ">ne-resize </a><br>
<a href="#" style="cursor: nw-resize">nw-resize</a><br>
<a href="#" style="cursor: n-resize">n-resize</a><br>
<a href="#" style="cursor: se-resize">se-resize</a><br>
<a href="#" style="cursor: sw-resize">sw-resize</a><br>
<a href="#" style="cursor: s-resize">s-resize</a><br>
<a href="#" style="cursor: w-resize">w-resize</a><br>
<a href="#" style="cursor: text">text</a><br>
<a href="#" style="cursor: wait">wait</a><br>
<a href="#" style="cursor: help">help</a><br>
</body>
11.怎样不使用页面的缓存?即每一次打开页面时不是调用缓存中的东西
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
12.页面打开时自动弹出一个窗口的代码怎么写?
HTML 代码片段如下:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="<B style="color:black;background-color:#A0FFFF">javascript</B>">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="MM_openBrWindow(‘‘‘‘http://www.35ui.cn/‘‘‘‘,‘‘‘‘,‘‘‘‘width=400,height=400‘‘‘‘)">
</body>
</html>
13.如何让我的页面出现一个会讲话的小人?Merlin
HTML 代码片段如下:
<HTML>
<HEAD>
<TITLE>默林</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY>
<p><OBJECT id=sims classid=CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F>
</OBJECT>
<SCRIPT>
var MerlinID;
var MerlinACS;
sims.Connected = true;
MerlinLoaded = LoadLocalAgent(MerlinID, MerlinACS);
Merlin = sims.Characters.Character(MerlinID);
Merlin.Show();
Merlin.Play("Surprised");
Merlin.Speak("大家好");
Merlin.Play("GestureLeft");
Merlin.Think("我是默林!");
Merlin.Play("Pleased");
Merlin.Think("可爱吗?");
Merlin.Play("GestureDown");
Merlin.Speak("哈哈!");
Merlin.Hide();
function LoadLocalAgent(CharID, CharACS){
LoadReq = sims.Characters.Load(CharID, CharACS);
return(true);
}
</SCRIPT>
</p>
<p> </p>
<p>看此效果必须装有office2000!!!</p>
</BODY>
</HTML>
14.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动
HTML 代码片段如下:
<html><head>
<STYLE>
body {background-image:url(logo.gif);
background-repeat:no-repeat; background-position:center }
</STYLE>
</head>
<body bgproperties="fixed" >
</body>
</html>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
background-repeat:no-repeat; 是让背景图不占满整个页面
body bgproperties="fixed" 是拉动scroll时背景图不动
15.文本输入框什么属性能实现不可输入?
HTML 代码片段如下:
<input type="text" name="textfield" disabled>
或者
<input type="text" name="textfield" readonly>
16.如何禁止自己的页面在别人的框架里打开?
把以下代码加至你的<head>区
<script>
if (window.top!=self){
window.top.location=self.location
}
</script>
17.如何实现首页全屏幕显示?
HTML 代码片段如下:
<html>
<body><script language="<B style="color:black;background-color:#A0FFFF">javascript</B>">
var coolw=642
var coolh=400
var coolhuang=window.open("http://www.35ui.cn","coolhuang","width="+coolw+",height="+coolh+",
fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0")
window.close()
</script></body></html>
18.如何监听一个窗口被关闭了?
HTML 代码片段如下:
<body onunload="alert(‘‘‘‘你关闭了这个窗口‘‘‘‘)">
19.如何禁止Ctrl+N?
HTML 代码片段如下:
<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey))>
如何把页面加入用户的收藏夹?
HTML 代码片段如下:
<a href="<B style="color:black;background-color:#A0FFFF">javascript</B>:window.external.AddFavorite(‘‘‘‘http://www.35ui.cn‘‘‘‘,‘‘‘‘无忧脚本‘‘‘‘)">收藏无忧脚本</a>
如何在我的'页面中加入背景音乐?
IE: <bgsound src="*.mid" loop=infinite>
NS:<embed src="*.mid" autostart=true hidden=true loop=true>
*.mid你的背景音乐的midi格式文件
关于页面转换效果
<meta http-equiv="page-enter" content="revealTrans(Duration=4,Transition=23)">
或
<meta http-equiv="page-exit" content="revealTrans(Duration=4,Transition=23)">
说明:Transition=23是随机效果,另可以选0-22任一数字固定某个效果
如何设定打开页面的大小
HTML 代码片段如下:
<body onload="top.resizeTo(300,200);"><!--(width,height)-->
怎样双击滚屏,单击停止?
HTML 代码片段如下:
<html>
<head>
<title>新网页1</title>
</head>
<body>
<script language"<B style="color:black;background-color:#A0FFFF">javascript</B>">
var currentpos,timer;
function initialize()
{
timer=setInterval("scrollwindow()",10);
}
function sc(){
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos != document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
</script>
<p>a</p><p>a</p><p>a</p><p>aa</p><p>aa</p><p>aa</p>
<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p>
<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p>
<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>a</p>
</body>
</html>
如何让body中的文字不被选中?
HTML 代码片段如下:
<body onselectstart="return false" >aaa</body>
如何让弹出的窗口不能关闭?
在新开的窗口中加入如下代码
<body onunload=open(location.href)>
</body>
如何让浏览器在保存页面时保存失败?
HTML 代码片段如下:
<NOSCRIPT>
<<B style="color:black;background-color:#ffff66">IFRAME</B> SRC="*.html">
</<B style="color:black;background-color:#ffff66">IFRAME</B>>
</NOSCRIPT>
表单中如何用图片按钮实现 reset?
<html>
<head>
<script>
function aaa(){
document.forms[0].reset()
}
</script>
</head>
<body>
<form>
<textarea rows="2" name="S1" cols="20"></textarea>
<input type="submit" values="提交" name="B1">
<image src="logo.gif" onclick=aaa()>
</form>
</body></html>
进入网页时弹出的信息对话框
<body onLoad="window.alert(‘‘‘‘欢迎光临本站‘‘‘‘)">
关闭窗口后弹出对话框
<body onUnload="window.alert(‘‘‘‘谢谢你的光临!欢迎下次再来!‘‘‘‘)">
告别提示
<body onUnload= alert("再见,感谢你的访问!")>
右键菜单的制作
<OBJECT id=menu type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM name="Command" value="Related Topics,menu">
<PARAM name="Item1" value="动易;http://www.35ui.cn">
<PARAM name="Item2" value="搜狐;http://www.35hu.cn">
<PARAM name="Item3" value="新浪;http://www.35no.cn">
<PARAM name="Item4" value="网易;http://www.chinsgp.cn">
<PARAM name="Item5" value="互动学院;http://www.35ui.cn">
</OBJECT> <script> if (document.all) document.body.onmousedown=new Function("if (event.button==2) menu.Click();") </script>
下拉菜单
<object id=HHCtrl type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <PARAM name="Command" value="Related Topics,Menu"> <PARAM name="Item1" value="aspease;http://www.35ui.cn"> <PARAM name="Item2" value="byhu;http://www.35ui.cn"> <PARAM name="Item3" value="lzz;http://www.35ui.cn"> </object> <a href=javascript:HHCtrl.Click() title="下拉菜单">下拉菜单</a>
;‘捌’ 帮我看看一段html 网页源码...为什么点击按钮"Click me" 后,输入框里面没有显示指定的值100呢
一楼说的在IE里边不支持这个方法但是IE8支持啊,这个方法IE 6 7没测,
document.getElementsByName(FirstName).value=100;
这一句里面有两个错误,
第一FirstName要加引号的
第二,这个方法得到是一个数组,所以你的.value=100;这样写是不对的,
正确的写法是
document.getElementsByName("FirstName")[0].value=100;
还有就是一楼说的你方法名写错了
‘玖’ HTML源代码是什么
网页空白处点击右键 查看源文件 那就是HTML代码x0dx0a用处就是以浏览器认识的格式 来布局网页 这里包括图片加载 文字样式等等信息x0dx0a你看到的东西应该在HTML里都能找到x0dx0ax0dx0a要使用的话 可以用DREAMWEAVER网页编辑软件来编辑HTML代码 这个软件有图形操作界面,你布局好 自己就生成相应的HTML代码