文件对象模型 [英] Document Object Model

查看:84
本文介绍了文件对象模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

**更舒适地查看HTML代码: http://img62.imageshack.us/img62/3008/codehtml.png
*更舒适地查看VB.NET代码: http://img684.imageshack.us/img684/3773/codevb.png

以下代码是使用自动建议"添加文本框:

*带有js和css文件,您可以从此处下载:

https://skydrive.live.com/embed?cid = A7DC52D8FBEB5D4C& resid = A7DC52D8FBEB5D4C!119& authkey = APemOTKhOSWvr-I

*More comfortable viewing HTML code: http://img62.imageshack.us/img62/3008/codehtml.png
*More comfortable viewing VB.NET code:http://img684.imageshack.us/img684/3773/codevb.png

The following code is add textbox with Auto Suggest:

*is come with js and css file, u can downlond from here:

https://skydrive.live.com/embed?cid=A7DC52D8FBEB5D4C&resid=A7DC52D8FBEB5D4C!119&authkey=APemOTKhOSWvr-I

下载 完整 代码(带有VB和html代码):

Or download the complete code(with VB and html code):

 

https://skydrive.live.com/embed?cid= A7DC52D8FBEB5D4C& resid = A7DC52D8FBEB5D4C%21122& authkey = ALxJYeLmWsLIriY

</html>
<头>
< /head>
<身体>
您好,MSDN,这是自动建议":< br>
< link rel ="stylesheet" type ="text/css" href =" http://MyServerPath/autosuggest.css"></link>
<脚本类型=文本/javascript" src =" http://MyServerPath/autosuggest.js"></script>
<脚本类型="text/javascript">
var custom_array = ['audi','bentley','buick'];
< /script>
<输入类型=文本"; id ="tb" />
<脚本类型=文本/javascript">新的autosuggest("tb",custom_array); </script>
< /body>
< /html>

结果(来自IE中的html文件):

-------------------------------------------------- -----------

-------------------------------------------------- ------------

问题:
我正在尝试使用Web浏览器将其添加到网站,但遇到了问题,没有向我显示自动建议"(仅显示文本框).


我使用此代码:

</html>
< head>
< /head>
< body>
hello MSDN, here is the "Auto Suggest": <br>
< link rel="stylesheet" type="text/css" href="http://MyServerPath/autosuggest.css"></link>
< script type="text/javascript" src="http://MyServerPath/autosuggest.js"></script>
< script type="text/javascript">
var custom_array = ['audi', 'bentley','buick'];
< /script>
< input type="text" id="tb" />
< script type="text/javascript"> new autosuggest("tb", custom_array); </script>
< /body>
< /html>

The result (from html file in IE):

-------------------------------------------------------------

--------------------------------------------------------------

The problem:
I'm trying to add itto site with the Web browser,it has encountered a problem and not shows me the Auto Suggest(It displays only the text box).


i use with this code:

私有子Form1_Load(ByVal发送者作为System.Object,ByVal e作为System.EventArgs)处理MyBase.Load
WebBrowser1.DocumentText =
<< html>> & vbNewLine& _
< head>" & vbNewLine& _
</head> & vbNewLine& _
<身体>" & vbNewLine& _
_
您好,MSDN,这是自动建议:< br>". & vbNewLine& _
_
</body>" & vbNewLine& _
"</html>"

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.DocumentText =
"<html>" & vbNewLine & _
"<head>" & vbNewLine & _
"</head>" & vbNewLine & _
"<body>" & vbNewLine & _
_
"hello MSDN, here is the Auto Suggest: <br>" & vbNewLine & _
_
"</body>" & vbNewLine & _
"</html>"

结束子

私人子btnTest_Click(ByVal发送者为System.Object,ByVal e为System.EventArgs)处理btnTest.Click

 

将ReplaceRemString设置为字符串=
您好,MSDN,这是自动建议:" & _
< link rel ="样式表"" type =" text/css" href ="
autosuggest.css""和"/link >"; & vbNewLine& _
<< script type =""文字/javascript"" src =""
autosuggest.js"></script " var custom_array = ['audi','bentley','buick'];'" & vbNewLine& _
</script>" & vbNewLine& _
<输入类型=""文本" id ="tb" />" & vbNewLine& _
<<脚本类型=""文本/javascript""新的autosuggest("tb",custom_array); </script>"

Dim ReplaceString As String =
"hello MSDN, here is the Auto Suggest:" & _
"<link rel=""stylesheet"" type=""text/css"" href=""
http://MyServerPath/autosuggest.css""></link>" & vbNewLine & _
"<script type=""text/javascript"" src=""
http://MyServerPath/autosuggest.js""></script>" & vbNewLine & _
"<script type=""text/javascript"">" & vbNewLine & _
"var custom_array = ['audi', 'bentley','buick'];" & vbNewLine & _
"</script>" & vbNewLine & _
"<input type=""text"" id=""tb"" />" & vbNewLine & _
"<script type=""text/javascript""> new autosuggest(""tb"", custom_array); </script>"


Dim bodyS As String = WebBrowser1.Document.Body.InnerHtml


Dim bodyS As String = WebBrowser1.Document.Body.InnerHtml

bodyS = Replace(bodyS,"hello MSDN,这是自动建议:",ReplaceString)

WebBrowser1.Document.Body.InnerHtml = bodyS

结尾子

End Sub

推荐答案

程序中图片下方的代码行在哪里?在文档中?

Where does the line of code under the picture in your program go? in the document?

 


这篇关于文件对象模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆