发布于 2015-04-24 05:54:51 | 199 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Javascript教程,程序狗速度看过来!

JavaScript客户端脚本语言

Javascript 是一种由Netscape的LiveScript发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如Perl,遗留的速度问题,为客户提供更流畅的浏览效果。


JS代码:

<script language="javascript">
function check(value)
{
document.getElementById(value).style.background= "black";
}
</script>

div处部分代码:

<div id="1" style=" color:#FFF; width:40px; height:40px; float:left; margin-right:10px; text-align:center;line-height:40px;">1</div>
<div id="2" style=" color:#FFF; width:40px; height:40px; float:left; margin-right:10px; text-align:center;line-height:40px;">2</div>
<div id="3" style=" color:#FFF; width:40px; height:40px; float:left; margin-right:10px; text-align:center;line-height:40px;">3</div>
<div id="4" style=" color:#FFF; width:40px; height:40px; float:left; margin-right:10px; text-align:center;line-height:40px;">4</div>
<div id="5" style=" color:#FFF; width:40px; height:40px; float:left; margin-right:10px; text-align:center;line-height:40px;">5</div>

radio处部分代码,使用onclick()函数调用check(),并加入参数,使得与参数相应的div颜色改变:

<div class="col-lg-12">
<p class="question-content">
<input type="radio" name="optionsRadios1" id="optionsRadios1" value="option1" onclick="check(1);">
A. 220(rm{V})、10(rm{A}) 
</p>
</div>


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务