<img src="3/4.gif">
<%#DataBinder.Eval(Container.DataItem,"date","{0:yyyy-MM-dd}")%>
【menu】
Me.Menu3.Items(0).Text = "鸟人"
Me.Menu3.Items(0).ChildItems(0).Text = "<img src='1.gif'>"
Me.Menu3.Items(0).ChildItems(1).Text = "070525051"
【 字体:<A href="javascript:ContentSize(16)">大</A>
<A href="javascript:ContentSize(14)">中</A> <A href="javascript:ContentSize(12)">小</A> 】
Dim temp1, temp2 As String
temp1 = Replace(myrow("计划内容"), "<BR>", vbCrLf)
TextBox1.Text = temp1
temp2 = Replace(myrow("完成质量"), "<BR>", vbCrLf)
TextBox2.Text = temp2
<body background="1/1.bmp"> <%--bgproperties="fixed"--%>
http://hi.baidu.com/startspace
1.关闭时提示“是否关闭”
Response.Write("<script language:javascript>javascript:window.close();</script>");
2.直接关闭不提示
Response.Write("<script language:javascript>javascript:window.opener=null;window.close();</script>");
【关闭并刷新父窗体】
Response.Write("<script>window.opener.location.href=window.opener.location.href;window.location.reload;window.close();</script>")
【网页背景】
<body background="1/2b63946139eaec8c8566b7683e0410af.jpg">
onunload="window.opener.location.href=window.opener.location.href;window.location.reload;"
【状态栏提示】
<asp:Button ID="Button1" runat="server" onmousemove="self.status='w shi '" onmouseout="self.status=''"
Text="Button" />
【QQ在线】
<a href="http://wpa.qq.com/msgrd?V=1&Uin=401490596&Site=forget&Menu=yes" target="_blank" title=" 点击与我聊天"><img src="http://wpa.qq.com/pa?p=1:410851346:7" alt="点击这里给我发消息 " style="border:0"/></a>
<a href="http://wpa.qq.com/msgrd?V=1&Uin=401490596&Site=forget&Menu=yes" target="_blank" title=" 点击与我聊天"><img src="http://wpa.qq.com/pa?p=1:410851346:7" alt="点击这里给我发消息 " style="border:0; width: 62px; height: 26px;"/></a>
【添加收藏夹】
Response.Write("<script>window.external.AddFavorite(location.href, document.title);</script>") '
【字体走动属性】
Dim STR As String = "· 首先" & "<br>" & "· 其次" & "<br>" & "· 再次" & "<br>" & "· 最后"
Response.Write("<marquee scrollamount=1 direction=up height=100 Width=100 onmouseover=this.stop(); onmouseout=this.start();>" & STR & "</marquee>")
Response.Write("<marquee scrollamount=1 direction=up height=30 onmouseover=this.stop(); onmouseout=this.start();>----- 今天暂时没有人参加游戏 -----</marquee>")
【子窗体刷新父窗体】
Response.Write("<script language = javascript>")
Response.Write("javascript:window.opener.location.href=window.opener.location.href;window.location.reload; ")
Response.Write("javasript:window.close();</script>")
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim temp As String, i As Integer, a() As String
TextBox2.Text = ""
temp = Replace(TextBox1.Text, ",,", ",") '修改“,,”为“,”
temp = Microsoft.VisualBasic.Left(TextBox1.Text, TextBox1.Text.Length - 1) '去除最后一个“,”
temp = Microsoft.VisualBasic.Left(temp, 1)
a = Split(temp, ",")
For i = 0 To UBound(a)
TextBox2.Text &= a(i) & vbCrLf
MsgBox(a(i))
Next i
End Sub
End Class
【播放音乐】
My.Computer.Audio.Play("1.wav")
【网页中的消息框】
Response.Write("<script>alert('注册成功!')</script>")
Page.RegisterStartupScript("alerm", "<script>alert('要显示的信息!');</script>")
Page.RegisterStartupScript("focus", "<script>window.onload=function(){alert('用户名或密码错误!');}</script>")
【传递数据】
这种方法是使用浏览器的网址来传递数据的,调用网页(WebForm1.aspx)的程序可以这样写:
Dim pram As String
pram = "Var1=" & Server.UrlEncode(TextBox1.Text) & "&"
pram = pram & "Var2=" & Server.UrlEncode(TextBox2.Text)
Response.Redirect("WebForm2.aspx?" & pram)
这里,Textbox1和Textbox2为需要传递的数据,需要注意的是,网页的网址后面要加上”?”,而各个数据之间要加上不含空格的“&”。
而被打开并且接受数据的网页(WebForm2.aspx)可以这样写:
TextBox1.Text = Request.QueryString("var2")
TextBox2.Text = Request.QueryString("var1")
【不同页面传递数据】
Response.Write("<script language=javascript>window.open('Default2.aspx?编号=" + 编号 + "','','channelmode = no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');</script>")
【后退、返回】
[格式]:history.go(-1) 或 history.back()
[说明]浏览器返回上一个已浏览的页面。
[举例]在<body></body>之间加入:
<a href="#" onclick=history.go(-1)><<返回</a>
或加入:<a href="#" onclick=history.back()>后退</a>
Response.Write("<script language=javascript>history.go(-2);</script>")
【网页返回顶部】
<a href="#TOP">返回顶部</a>
【datagrid查询】
Dim strconn As String
strconn = "data source=(local);initial catalog=CRM;uid=sa;pwd=;integrated security=sspi;"
Dim strsql As String
Dim ds1 As New DataSet
strsql = "use CRM select * from 客户信息 where 客户姓名 like '" & TextBox13.Text + "%" & "' "
Dim adatype As New SqlDataAdapter(strsql, strconn)
adatype.Fill(ds1, "客户信息")
DataGrid2.DataMember = "客户信息"
DataGrid2.DataSource = ds1
DataGrid2.DataBind()
adatype.Dispose()
【寻找某个字符在字符串中的个数】
dim str, temp as string
dim n as long
str = "123|456|789|000"
temp = replace(str, "|", "")
n = len(str)- len(temp)
msgbox str & "中" & "|" & "出现" & n & "次"
【时间正则表达式】
[\d]{4}-[0,1]?[\d]-[0-3]?[\d] '时间
【datagrid赋值到数据库】
TextBox1.Text = DataGrid1.SelectedItem.Cells(2).Text
TextBox2.Text = DataGrid1.SelectedItem.Cells(3).Text
TextBox3.Text = DataGrid1.SelectedItem.Cells(4).Text
TextBox4.Text = DataGrid1.SelectedItem.Cells(5).Text
TextBox5.Text = DataGrid1.SelectedItem.Cells(6).Text
TextBox6.Text = DataGrid1.SelectedItem.Cells(7).Text
TextBox7.Text = DataGrid1.SelectedItem.Cells(8).Text
TextBox8.Text = DataGrid1.SelectedItem.Cells(9).Text
TextBox9.Text = DataGrid1.SelectedItem.Cells(10).Text
TextBox10.Text = DataGrid1.SelectedItem.Cells(11).Text
TextBox11.Text = DataGrid1.SelectedItem.Cells(12).Text
TextBox12.Text = DataGrid1.SelectedItem.Cells(13).Text
【刷新、刷新跳转页面】
页面自动刷新:把如下代码加入<head>区域中<meta http-equiv="refresh" content="20">,其中20指每隔20秒刷新一次页面.
页面自动跳转:把如下代码加入<head>区域中<meta http-equiv="refresh" content="20;url=http://www.cn76.com">,其中20指隔20秒后跳转到http://www.cn76.com页面。
【数据库值传到文本控件】
Dim 编号 As String = TextBox3.Text
Dim cn As New SqlConnection("data source=(local);initial catalog= CRM;uid=sa;pwd=;integrated security=sspi;")
cn.Open()
Dim cm As New SqlCommand("use CRM select 角色 from 用户信息 where 编号=@编号", cn)
cm.Parameters.Add("@编号", SqlDbType.NVarChar, 20)
cm.Parameters("@编号").Value = 编号
Dim a As String = cm.ExecuteScalar
【更新数据库数据】
Dim strconn As New String("data source=(local);initial catalog=CRM;uid=sa;pwd=;integrated security=sspi;")
Dim objconn As New SqlConnection(strconn)
Dim objAdap As New SqlDataAdapter
Dim objDset As New DataSet
objconn.Open()
Dim strupd As String = "update 客户联系记录 set 联系人= '" & TextBox3.Text & "',公司名称='" & TextBox4.Text & "',联系方式='" & TextBox5.Text & "',联系时间='" & TextBox6.Text & "',记录时间='" & TextBox7.Text & "',联系地点='" & TextBox8.Text & "',讨论主题='" & TextBox9.Text & "',记录人='" & TextBox10.Text & "' where 编号='" & TextBox2.Text & "'"
Dim objcmd As New SqlCommand(strupd, objconn)
objcmd.ExecuteNonQuery()
objconn.Close()
MsgBox("更新成功!")
【返回数据库中行数】
Dim j As String
Dim cm12 As New SqlCommand("use CRM select count(1) as RecordCount from 消息", cn)
j = cm12.ExecuteScalar
LinkButton13.Text = "已读消息" & "(" & "总共" & j & "条消息" & ")"""
【数据绑定到listbox】
Dim cn1 As New SqlConnection("data source=(local);database=CRM;uid=sa;pwd=;integrated security=sspi;")
cn1.Open()
Dim cm1 As New SqlCommand
Dim dr1 As SqlDataReader
cm1.CommandText = "select 姓名 from 用户信息 "
cm1.Connection = cn1
dr1 = cm1.ExecuteReader
Me.ListBox1.DataSource = dr1
Me.DropDownList1.DataTextField = "姓名"
Me.ListBox1.DataValueField = "姓名"
Me.ListBox1.DataBind()
【一个网页打开另一个独立的网页】
在属性里加上 onClientClick="window.open('xxx.aspx')"
【获取IP】
TextBox1.Text = Request.UserHostAddress
【打开模拟窗体】
Response.Write("<script language=javascript>window.showModalDialog('2.aspx','','channelmode = no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');</script>")
1.window.showModalDialog("DialogPage.aspx","newwin","dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
2.window.close();
3.winform 和webform之间传值
Process.Start("IExplore.exe", "http://192.168.1.62/login.aspx?para1=aaa");
DialogPage.aspx:
string str1=Request.QueryString["para1"].toString();
string str2=Request.QueryString["para2"].toString();
返回值
DialogPage.aspx:
window.returnValue="aaa";
ParentPage.aspx:
var str=window.showModalDialog("DialogPage.aspx");
4.
aspx页面在showmodeldialog情况下为什么一提交就重新打开一个页面?
showmodaldialog打开的页面中在<head></head>之间加入一行:<base target="_self">
【打开两种不同的窗体】
Dim ID As String = TextBox2.Text
'Response.Write("<script language=javascript>showModalDialog('2.aspx?b=" + ID + " ','win');</script>")
Response.Write("<script language='javascript'>showModelessDialog('2.aspx?b=" + ID + " ','win');</script>")
【关闭窗体】
Response.Write("<script language='javascript'>window.close()</script>")
【子窗体刷新父窗体】
Response.Write("<script>opener.location.reload();window.close();</script>")
【关闭网页提示】
<body onunload="window.alert('亲爱的朋友,谢谢您的访问!\n\n祝您走好!别忘了我的网址哦!\n\n xuon.cn \n\nxuon.165blog.com')"></body>
1、<meta http-equiv= "Content-Type"contect="text/html";charset=gb_2312-80">和 <meta http-equiv="Content-Language" contect="zh-CN">用以说明主页制作所使用的文字以及语言;又如英文是ISO-8859-1字符集,还有BIG5、utf-8、shift-Jis、Euc、Koi8-2等字符集;
2、<meta http-equiv="Refresh" content="n; url= http://yourlink";;>
定时让网页在指定的时间n秒内,跳转到页面http://yourlink;
3、<meta http-equiv="Expires" contect="Mon,12 May 2001 00:20:00 GMT">可以用于设定网页的到期时间,一旦过期则必须到服务器上重新调用。需要注意的是必须使用GMT时间格式;
4、<meta http-equiv="Pragma" contect="no-cache">是用于设定禁止浏览器从本地机的缓存中调阅页面内容,设定后一旦离开网页就无法从Cache中再调出;
5、<meta http-equiv="set-cookie" contect="Mon,12 May 2004 00:20:00 GMT">cookie设定,如果网页过期,存盘的cookie将被删除。需要注意的也是必须使用GMT时间格式;
6、<meta http-equiv="Pics-label" contect="">网页等级评定,在IE的internet选项中有一项内容设置,可以防止浏览一些受限制的网站,而网站的限制级别就是通过meta属性来设置的;
7、<meta http-equiv="windows-Target" contect="_top">强制页面在当前窗口中以独立页面显示,可以防止自己的网页被别人当作一个frame页调用;
【网页调用EXE程序】
Dim Process2 As New System.Diagnostics.Process
Process2.StartInfo.FileName = "时钟.exe"
Process2.Start()
Window.open的参数
window.open('xxxx.asp','Derek','height=100,width=100,status=yes,toolbar=yes,
menubar=no,location=no')
此语句打开一个新窗口,页面为xxxx.asp,名字为Derek,高为100,宽为100,显示状态栏和工具条,不显示菜单和地址。
具体各个属性参数如下:
window.open(URL,name,features)
URL:新窗口的URL地址
name:新窗口的名称,可以为空
featurse:属性控制字符串,在此控制窗口的各种属性,属性之间以逗号隔开。
fullscreen=yes/no 是否全屏,默认no
channelmode=yes/no 是否显示频道栏,默认no
toolbar=yes/no 是否显示工具条,默认no
location=yes/no 是否显示地址栏,默认no
directories=yes/no 是否显示转向按钮,默认no
status=yes/no 是否显示窗口状态条,默认no
menubar=yes/no 是否显示菜单,默认no
scrollbars=yes/no 是否显示滚动条,默认yes
resizable=yes/no 是否窗口可调整大小,默认no
width=number 窗口宽度(像素单位)
height=number 窗口高度(像素单位)
top=number 窗口离屏幕顶部距离(像素单位)
left=number 窗口离屏幕左边距离(像素单位)
【在刷新和提交页面后,保存你的页面滚动条的位置】
Private Sub RetainScrollPosition()
Dim saveScrollPosition As New StringBuilder
Dim setScrollPosition As New StringBuilder
RegisterHiddenField("__SCROLLPOS", "0")
saveScrollPosition.Append("<script language='javascript'>")
saveScrollPosition.Append("function saveScrollPosition() {")
saveScrollPosition.Append(" document.forms[0].__SCROLLPOS.value = thebody.scrollTop;")
saveScrollPosition.Append("}")
saveScrollPosition.Append("thebody.onscroll=saveScrollPosition;")
saveScrollPosition.Append("</script>")
RegisterStartupScript("saveScroll", saveScrollPosition.ToString())
If (Page.IsPostBack = True) Then
setScrollPosition.Append("<script language='javascript'>")
setScrollPosition.Append("function setScrollPosition() {")
setScrollPosition.Append(" thebody.scrollTop = " & Request("__SCROLLPOS") & ";")
setScrollPosition.Append("}")
setScrollPosition.Append("thebody.onload=setScrollPosition;")
setScrollPosition.Append("</script>")
RegisterStartupScript("setScroll", setScrollPosition.ToString())
End If
End Sub
请发表评论