点击显示隐藏层
在用户注册时点击多选框。显示填写高级资料。点击文章标题显示文章简介。点击留言标题显示留言内容。
Cngothic不会AJAX做不了异步交互的效果。通常使用JS来做类似的效果。发个使用的代码示例:
- <script type="text/javascript">
- function look(id){
- if (id.style.display == "none"){
- id.style.display=""
- }
- else {
- id.style.display="none"
- }
- }
- </script>
- <style type="text/css">
- #content {margin-top:20px; background:#ccc; height:200px; }
- </style>
- <div id="title">
- <label>点击显示高级选项</label><input name="" type="checkbox" value="" onClick="look(content1)">
- </div>
-
- <div id="content1" style="display:none;">
- 高级选项内容!
- 这种效果大多用到会员注册表单上面。知道使用方法后可以演变出很多效果。Cngothic变常用到文章列表中。
- Cngothic不会AJAX做不了异步交互。呵呵。
- </div>
display, onclick, 隐藏层
表单元素onfous()改变样式 当表单内的文本框获取焦聚时其文件框的样式改变。看这句以为Cngothic当时会以为是在每个表单元素上面加一句JS。如:onfous=”..”.今个在织梦里看到一个不错例子便收录下来.有兴趣的朋友可以看看。

Read the rest of this entry »
onfous(), 样式, 表单
推荐一款漂亮的日历插件.相比Cngothic另一日志中提到的网页日期/日历控件-Web Calendar拥有更弦的界面。采用CSS做的界面可以很方便的修改界面。应用于网中。来选择日期是那么的方便。经我测试这个好像不可以选择今天以前的时间。
漂亮的日历插件下载

Read the rest of this entry »
Web Calendar 网页日历, 日期控件, 网页日历, 表单
window.top.document的用法巧秒解决更换顶层窗口样式
这个是我在做限制IP段时用到的。举例说明下。
静态内容页上如何判断IP段尼。想来想去了就两种方法:
1:输写JS进行。插入到内容页后。让其运行达到判断的效果。这种方法要用到插件会被 IE 提示拦截。
2:在页面顶部加入<iframe src=”ip.asp”></iframe>。在ip.asp里处理。
Read the rest of this entry »
window.top, 限制IP段
1只能是英文和数字有两种实现方法,2只能输入英文和数字,3只能输入数字,4只能输入中文正则方法
1只能是英文和数字有两种实现方法
- <input onkeyup="value=value.replace(/[\W]/g,'')"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeydown="if(event.keyCode==13)event.keyCode=9">
2只能输入英文和数字
- <input onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
2只能输入只能输入中文
- <input onkeyup="value=value.replace(/[ -~]/g,'')" onkeydown="if(event.keyCode==13)event.keyCode=9">
javascript脚本 文本框
document.getElementById使用方法1
我想把one1拆开1这个在子程序里传递过去。后跟one组合在一起。做id。
这样给 id 为 one1 的对象加样式。
(”one”+a).style.background=”#f00″;这种写法不对。现用到了
document.getElementById
看下面试例:
- <script type="text/javascript">
- function sub(a){
- document.getElementById("one"+a).style.background="#f00";
- }
- </script>
- <div id="one1" style="background:#ccc; width:100px; height:100px;" onclick="return sub('1')"></div>
document.getElementById, Javascript脚本