2006年07月31日
使用asp尽量减少服务器端的工作量,这样就应该多使用javascript,把所有提交字段使用javascript或vbscript检测后提交给服务器,这样服务器就不必再作检测,而在提交时可能会有人修改script从本地提交,这样存在安全提交的问题,所以应该要求从服务器断路径提交,其他地址提交提交无无效:
- <%
- server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
- server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
- if mid(server_v1,8,len(server_v2))<>server_v2 Then
- response.write "<center><table border=1 cellpadding=20 bordercolor=black bgcolor=#EEEEEE width=450>"
- response.write "<tr><td style='font:9pt Verdana'>"
- response.write "你提交的路径有误,禁止从站点外部提交数据请不要乱该参数!"
- response.write "</td></tr></table></center>"
- response.End
- end If
- %>
2006年07月31日
下午和DW8的兄弟们在群里针对这个问题讨论了很久~!我的思路就是:用户登陆时对application(“pass”)的值进行判断,如果application(“pass”)的值不为空,那么就提示已经有人登陆~否则登陆(说明是第一个登陆的用户)并给application(“pass”)赋一个值,然后加一个在线人数的判断,有在线人数时 application(“pass”)不等于空,没有在线人数时用application.contents.remove(“pass”)来清除application(“pass”)的值.
具体application.contents.remove的用户可以参考:http://www.kekecn.com/blog/article.asp?id=637具体方法如下:
- <%
- '有个online的表记录在线的人员,登陆时判断在线人数~!如果在线人数不为0则application("pass")="nopass",在线人数为0的话就对application进行一次清除
- if application("pass")="nopass" then
- response.write "系统中已有用户登陆"
- response.end
- end if
- %>
随后的系统中就得对在线人数进行统计了,如果在线人数为0则用
application.contents.remove(“pass”) 来清除 application(“pass”) 的值.
2006年07月31日
object.innerHTML: object所包含的元素的HTML,不包含object
object.outerHTML: object及它所包含元素的HTML,包含object
- <a href="#" onclick="alert(this.innerHTML)">this is innerHTML</a>
- <a href="#" onclick="alert(this.outerHTML)">this is outerHTML</a>
来个应用的
- <a href="#" onclick="this.innerHTML='<p onclick=alert(this.outerHTML)>this is outerHTML</p>' ">this is innerHTML</a>
上面都是采用的this本身,下面采用id对应object
- <button onclick=alert(obj1.innerHTML)>obj1.innerHTML</button>
- <button onclick=alert(obj2.outerHTML)>obj2.outerHTML</button>
- <div id=obj1><font color=blue>cnbruce</font></div>
- <div id=obj2><font color=red>cnrose</font></div>
-
- <select NAME="cn_who">
- <option value="male">cnbruce</option>
- <option value="female">cnrose</option>
- </select>
-
- <input TYPE="button" VALUE="The Node" onClick="alert(cn_who.children[0].nodeName)">
- <input TYPE="button" VALUE="The Name" onClick="alert(cn_who.children[0].innerText)">
- <input TYPE="button" VALUE="The Sex" onClick="alert(cn_who.children[0].value)">
- <input TYPE="button" VALUE="The Node" onClick="alert(cn_who.children[1].nodeName)">
- <input TYPE="button" VALUE="The Name" onClick="alert(cn_who.children[1].innerText)">
- <input TYPE="button" VALUE="The Sex" onClick="alert(cn_who.children[1].value)">
-
- <a href="#" onclick="this.insertAdjacentText('afterEnd',' cnbruce ')">insertAdjacentText</a>
0个评论 标签: