从WebBrowser的HTML元素获取属性值 [英] Get attribute value from HTML element in WebBrowser
问题描述
我需要括号中的数字,在这种情况下是14,以便我可以将它发送到页面上的JavaScript函数来提交,或者有一种方法可以点击按钮当前周?
I need the number in brackets, in this case "14" so that I can send it to a JavaScript function on the page to submit or alternatively is there a way to 'click' the button "Current week"?
<form id="timetablesForm" action="timetablesController.jsp" method="post">
<p>
<input type="button" name="Current week" value="Current week" onclick="javascript:void+displayTimetable('14')" />
<input type="button" name="Next week" value="Next week" onclick="javascript:void+displayTimetable('15')" />
<input type="button" name="Current semester" value="Semester 1" onclick="javascript:void displayTimetable('7;8;9;10;11;12;13;14;15;16;17;21')" />
</p>
function displayTimetable(selectdweeks)
我正在使用Windows Phone WebBrowser.Document
不可用。我使用下面的脚本以不同的形式设置值:
I'm working in Windows Phone so the WebBrowser.Document
isn't available. I've used the script below to set a value in a different form:
webBrowser1.InvokeScript("eval", "document.getElementById('loginform1').user.value = 'username';");
如何从HTML页面获取值?我可以用 InvokeScript
调用哪些其他函数?赞赏它,如果你能指出我的功能列表。
How do I get a value from the HTML page? What other function can I call with InvokeScript
? Appreciate it if you can point me at a list of functions.
推荐答案
$ b
webBrowser1.SaveToString()
然后解析HTML获得我想要的位
Then parse the HTML to get the bit I want
这篇关于从WebBrowser的HTML元素获取属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!