VB.Net如何在javascript中下载URL?

时间:2018-07-31 07:48:51

标签: javascript .net hyperlink

如何在javascript中或单击下载按钮后获取当前链接。

  Dim HtmlColl As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("button")
        For Each elem As HtmlElement In HtmlColl
            If elem.GetAttribute("id").Equals("downloadbtn") Then
                elem.InvokeMember("click")
            End If
        Next

网络来源:

http://xsitex.com/lrqpbs6uyca0/url_javascr.jpg.html

<div class="download-button-block">
				<div class="clear"></div>
					<button id="downloadbtn" class="green-button">
						<span class="btext">Download file</span>
					</button>
			</div> <!--end right column-->
		</form>

<br><center>
<script type="text/javascript"><!--<![CDATA[
/* PLACEMENT: Setup.xsitex.com.xsitex.com_980x250 */
if(location.protocol.substr(0,4)=='http')document.write(unescape('%3C')+'script id="Setup.xsitex.com.xsitex.com_980x250" src="'+location.protocol+'//lv.adocean.pl/_'+(new Date()).getTime()+'/ad.js?id=SwaXpdclN776PUuiIkkTHSZPXg_FnPrrh06YBtN1u8X.M7/x='+screen.width+'/y='+screen.height+'" type="text/javascript"'+unescape('%3E%3C')+'/script'+unescape('%3E'));
//]]>--></script>
</center>

1 个答案:

答案 0 :(得分:0)

您需要这样的想法,我希望)

http://xsitex.com/lrqpbs6uyca0/url_javascr.jpg.html

<div class="download-button-block">
				<div class="clear"></div>
					<button id="downloadbtn" class="green-button">
						<span class="btext">Download file</span>
					</button>
			</div> <!--end right column-->
		</form>

<br><center>
<script type="text/javascript"><!--<![CDATA[
/* PLACEMENT: Setup.xsitex.com.xsitex.com_980x250 */
document.querySelector('#downloadbtn').addEventListener('click', function() {
    if(location.protocol.substr(0,4)=='http') {
        document.write(unescape('%3C')+'script id="Setup.xsitex.com.xsitex.com_980x250" src="'+location.protocol+'//lv.adocean.pl/_'+(new Date()).getTime()+'/ad.js?id=SwaXpdclN776PUuiIkkTHSZPXg_FnPrrh06YBtN1u8X.M7/x='+screen.width+'/y='+screen.height+'" type="text/javascript"'+unescape('%3E%3C')+'/script'+unescape('%3E'));
    }
})
//]]>--></script>
</center>