如何在html中插入vb语句

html-css011

如何在html中插入vb语句,第1张

就是ASP了,

1.新建个HTML文件,

保存成.ASP文件

2.在需要插入VB代码的地方,

写上:

<%

%>

3.在<%和%>之间写上VB代码

4.文件放到IIS目录下,

运行

举例:

<html>

<head>

<title>举例</title>

</head>

<body>

<%

a

=

1

b

=

2

c

=

a

+

b

%>

<%=a%>+<%=b%>=<%=c%>

</body>

</html>

这就是个ASP程序,

第一个

<%

...

%>

之间的部分就是VB程序,

计算加法.

下面一句出现的<%和%>比较多.

<%=a%>,

就是显示变量a的值,

其他部分原样显示,

所以:

<%=a%>+<%=b%>=<%=c%>

就会显示成:

1+2=3

大致就这样子,

你再找些书看看,

还是挺简单的.

用webbrower控件

请看下例

’声明:该程序由csdn论坛获得

dim dwinfolder as new shellwindows

dim withevents eventie as webbrowser_v1

private sub command1_click()

dim objie as object

for each objie in dwinfolder

if objie.locationurl = list1.list(list1.listindex) then

set eventie = objie

command1.enabled = false

list1.enabled = false

text1.text = ""

exit for

end if

next

end sub

private sub eventie_navigatecomplete(byval url as string)

text1.text = text1.text + chr(13) + chr(10) + url

end sub

在运行前。点击菜单 projects | references 项,在available references 列表中选择microsoft internet controls项将internet对象引用介入到工程中

private sub form_load()

dim objie as object

for each objie in dwinfolder

if instr(1, objie.fullname, "iexplore.exe", vbtextcompare) <> 0 then

list1.additem objie.locationurl

end if

next

command1.caption = "正文"

end sub

private sub form_unload(cancel as integer)

set dwinfolder = nothing

end sub

private sub list1_click()

dim objdoc as object

dim objie as object

for each objie in dwinfolder

if objie.locationurl = list1.list(list1.listindex) then

set objdoc = objie.document

for i = 1 to objdoc.all.length - 1

if objdoc.all(i).tagname = "body" then

text1.text = objdoc.all(i).innertext

end if

next

exit for

end if

next

end sub