点击显示隐藏层
用户注册时点击多选框。显示填写高级资料。点击文章标题显示文章简介。点击留言标题显示留言内容。
Cngothic不会AJAX做不了异步交互的效果。通常使用JS来做类似的效果。发个使用的代码示例:

  1. <script type="text/javascript">
  2. function look(id){
  3. if (id.style.display == "none"){
  4. id.style.display=""
  5. }
  6. else {
  7. id.style.display="none"
  8. }
  9. }
  10. </script>
  11. <style type="text/css">
  12. #content {margin-top:20px; background:#ccc; height:200px; }
  13. </style>
  14. <div id="title">
  15. <label>点击显示高级选项</label><input name="" type="checkbox" value="" onClick="look(content1)">
  16. </div>
  17.  
  18. <div id="content1" style="display:none;">
  19. 高级选项内容!
  20. 这种效果大多用到会员注册表单上面。知道使用方法后可以演变出很多效果。Cngothic变常用到文章列表中。
  21. Cngothic不会AJAX做不了异步交互。呵呵。
  22. </div>

, ,

表单元素onfous()改变样式 当表单内的文本框获取焦聚时其文件框的样式改变。看这句以为Cngothic当时会以为是在每个表单元素上面加一句JS。如:onfous=”..”.今个在织梦里看到一个不错例子便收录下来.有兴趣的朋友可以看看。

Read the rest of this entry »

, ,

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

, , ,

window.top.document的用法巧秒解决更换顶层窗口样式
这个是我在做限制IP段时用到的。举例说明下。
静态内容页上如何判断IP段尼。想来想去了就两种方法:
1:输写JS进行。插入到内容页后。让其运行达到判断的效果。这种方法要用到插件会被 IE 提示拦截。
2:在页面顶部加入<iframe src=”ip.asp”></iframe>。在ip.asp里处理。
Read the rest of this entry »

,

1只能是英文和数字有两种实现方法,2只能输入英文和数字,3只能输入数字,4只能输入中文正则方法
1只能是英文和数字有两种实现方法

  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只能输入英文和数字

  1. <input onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">

2只能输入只能输入中文

  1. <input onkeyup="value=value.replace(/[ -~]/g,'')" onkeydown="if(event.keyCode==13)event.keyCode=9">

document.getElementById使用方法1
我想把one1拆开1这个在子程序里传递过去。后跟one组合在一起。做id。
这样给 id 为 one1 的对象加样式。
(”one”+a).style.background=”#f00″;这种写法不对。现用到了
document.getElementById
看下面试例:

  1. <script type="text/javascript">
  2.  function sub(a){
  3.  document.getElementById("one"+a).style.background="#f00";
  4.  }
  5. </script>
  6. <div id="one1" style="background:#ccc; width:100px; height:100px;" onclick="return sub('1')"></div>

,