VB中关于webbrowser使用的问题

wxg504 2009-08-10 11:05:34
我用webbrowser制作了登陆窗口,并通过登陆窗口进去到网页,成功了,可是进去网页后,我想自动打开其中的一个链接,这时候不知道怎么写代码了,
网页部分代码如下:<li><a class="tab" href="#news"><span>News</span></a></li>
<li><a class="tab" href="#work"><span>Captcha</span></a></li>
<li><a class="tab" href="#payments"><span>Payments</span></a></li>
<li><a class="tab" href="#profile"><span>Profile</span></a></li>
我想自动打开Captcha的链接,请问该如何做呢,打开这个链接后,我想网页在webbrowser中的显示的是网页的底部,有如下代码:WebBrowser1.Document.body.scrollTop = WebBrowser1.Document.body.scrollHeight

请问这个自动打开连接改如何实现呢?

网页中还有个数据, 部分网页代码如下:tr>
<td>Ballance (updated with 2 minutes delay) : <div id="ballance" style="color:#cc0000">0.000</div></td>
</tr>
我想在VB上弄个标签,和0.000这个数据同步,请问,该如何做?
...全文
119 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wxg504 2009-08-11
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
Dim vDoc, vTag

Dim i As Integer

Set vDoc = WebBrowser1.Document

For i = 0 To vDoc.All.Length - 1 '检测所有标签

If UCase(vDoc.All(i).innerText) = "ballance" Then '找到ballance标签

Set vTag = vDoc.All(i)
End If
Next i
Text1.Text = vTag

End Sub

我用这个代码,而得到的是个空值,请问该如何修改呢?
wxg504 2009-08-11
  • 打赏
  • 举报
回复
<html>

<head>


function makeorder()
{
var url = 'order.php?action=step1&hash=' + $("#hash").val() + '&userid='+ $("#id").val();

window.open(url,"_blank","toolbar=no, location=no, \
directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, \
copyhistory=no, width=400, height=150")

}


$(document).ready(function() {

$("#tabs").tabs("tabs",{
onClick: confirmation
});

$("#loading").ajaxStart(function(){
$(this).show();
});

$("#loading").ajaxStop(function(){
$(this).hide();
});

$("#captcha_list").html("");

prepost(0);
/* prepost(1);
prepost(2);
prepost(3);
prepost(4);
prepost(5);
*/

});


function prepost(index)
{
$.post("captcha.php", { "action":"new",
"hash": $("#hash").val(),
"r" : Math.random()},
function(data)
{
if (data=='0')
{
$("#captcha_img"+index).attr({"src":"/images/na.jpg"});
} else
{
var r = data.split("\n");
$("#captcha_id"+index).val(r[1]);
$("#ballance").html(r[2]);
$("#captcha_img"+index).attr({"src": r[0]});
}
});
}


function confirmation(rm, tab, old)
{
current_tab = tab;
current_old = old;
}

function logout()
{
var result = confirm("Are You Sure ?");
if (result==true)
{
document.location = "/?action=logout";
}
}

function save_profile()
{
$.get("index.php", { "email": $("#email").val() ,
"password": $("#password").val() ,
"payment_detail": $("#payment_detail").val(),
"action": "update_profile",
"hash": $("#hash").val(),
"r" : Math.random() } );
}

function uploadNewcaptcha(index)
{
var captcha_text = $("#captcha_text"+index).val();
var captcha_id = $("#captcha_id"+index).val();
// alert(captcha_text + ' ' + $("#captcha_id"+index).val());
if (captcha_text.length>2)
{
$("#captcha_img"+index).attr({"src":"/images/waiting.gif"});
$("#captcha_text"+index).val("");
$("#captcha_text"+index).attr("disabled","disabled");
$("#send_button"+index).attr("disabled","disabled");

$.post("captcha.php", { "action":"send",
"hash": $("#hash").val(),
"r" : Math.random(),
"captcha_text": captcha_text,
"captcha_id" : captcha_id
},
function(data)
{
if (data!='0')
{
var r = data.split("\n");
$("#captcha_img"+index).attr({"src":r[0]});
$("#captcha_id"+index).val(r[1]);
$("#ballance").html(r[2])
$("#captcha_text"+index).removeAttr("disabled");
$("#send_button"+index).removeAttr("disabled");
$("#captcha_text"+index).focus();
}
}
);

}
}


function CheckEnter(tvent, index)
{
if (tvent.keyCode==13)
{
uploadNewcaptcha(index);
}
}

</script>


</head>

<body style="margin:0px;">
<center>
<h5>
<font color=#0000AA>Hi. We have good news for you. Now we're increase our rates to <b><font color=#FF0000>0.002$</font></b>. <br>We hope that this great news help you earning some more and you will working more harder</font>
</h5>
<h3>
<font color=#00AA00>Now we're monitoring quality of your work.<br>If you'll type many bad answers - we'll delete your account without any payments.<br>Write captcha's more closely. Thanks.</font>
</h3>
</center>
<div id="loading" style="border:1px solid #CCC;font-size:12px;text-align:center;position:absolute;background:yellow;padding-top:5px;display:none;width:200px;height:20px;left:35%;top:7px;">Uploading/Loading Data...</div>
<br>
<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr><td colspan="2" style="height:15px;"></td></tr>

<tr>
<td align="left" style="width:600px">
<table border=0 width=100%>
<tr>
<td>Ballance (updated with 2 minutes delay) : <div id="ballance" style="color:#cc0000">0.000</div></td>
</tr>
</table>
</td>
<td align="right"><div style="padding-right:20px"><a href=# onclick="logout()">Log Out</a></div></td>
</tr>
<tr>
<td colspan="2" align=center>

<div id="tabs">
<ul>
<li><a class="tab" href="#news"><span>News</span></a></li>
<li><a class="tab" href="#work"><span>Captcha</span></a></li>
<li><a class="tab" href="#payments"><span>Payments</span></a></li>
<li><a class="tab" href="#profile"><span>Profile</span></a></li>
</ul>

<div id="news">
<b>
<br><br>
<font color=#555555>
<p><h2><font color=#FF0000>Your balance is updated after short time, not immediately, <br>and you can withdraw your money immediately from Liberty Reserve!</font></h2></p>
<hr width=50%>
<p>We're opening. We pay via <a href="http://www.libertyreserve.com/?ref=U2865644"><font color=#008800>Liberty Reserve</font></a> (now it's more better than e-gold) . </p>
<p>Our rates: <font color=#FF0000>1 correct recognization = 0.002$.</font><p>
<p>If you'll find bugs - contact us by mail : <i>captcha2cash at gmail dot com</i><p>
<p>Thanks for your job.</p>
</font>
</b>
</div>

<div id="work">
<br><br>
<table border=0>
<tr>
<!--- <td valign=top style="width:600px">
<table style="border:1px solid #000000">
<tr style="border:1px solid #000000">
<td align="center" style="border:1px solid #000000;background:#EEEEEE"><b>Zooming</b></td>
</tr>
<tr style="border:1px solid #000000">
<td valign="top" style="border:1px solid #000000">
<img src="" id="captcha_img_zoom" border=0></img>
</td>
</tr>
</table>


这是部分网页代码
rztyfx 2009-08-11
  • 打赏
  • 举报
回复
这个没有链接,只有锚点,类似这样的形式,xxx.com/index.asp#work
找到<div id="ballance"这个标签,然后读取它的值就可以了innertext

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧