添加收藏夹,只运行一次的javascript代码
function get_cookie(Name)
{
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0)
{
var offset = document.cookie.indexOf(search)
if (offset != -1)
{
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function WindowClose()
{
var s = get_cookie('bookmarkit')
alert(s)
if (s=='')
{
if( confirm("感谢您访问本网站。您愿意收藏天气在线吗?"))
{
document.cookie="bookmarkit=yes"
JSAddFavorite()
}
}
}
相关文档:
<mce:script type="text/javascript"><!--
function SetCookie(name,value,expire) {
var exp = new Date();
exp.setTime(exp.getTime() + expire);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
} ......
<html>
<head>
<title>测试输入字符</title>
<script language=javascript>
String.prototype.lenB =function(){
return this.replace(/[^\x00-\xff]/g,"**").length;
}
function a() ......
最近的项目开发中 遇到一些需要根据具体情况动态添加javaScript脚本,然后执行脚本 于是收集了一下:
1 在控件的绑定事件中添加脚本 如:在gridview控件的rowdatabind事件中可以实现 指针的选中行不同色显示 可添加脚本
protected void gvEngineerRepairState_RowDataBound(object sender, GridViewRowEventArgs e ......
--------------------------------------------------------------------------------
<body>
<mce:script type="text/javascript"><!--
document.write("如果显示了这段文字,那么您的浏览器支持 JavaScript!")
// --></mce:script>
<noscript>No JavaScript support!</noscript&g ......