Scan a string on this webpage, and then scan the string

Source: Internet
Author: User

Scan a string on this webpage, and then scan the string

/* Get the content in the body */

// Var content = document. getElementsByTagName ("body") [0]. innerHTML;

/* If there are many iframe values in the body, you need to find them cyclically */

Var contents = document. getElementsByTagName ("iframe ");
// Var content = $ (contents [0]). contents (). find ("body" example .html ();


Var size = contents. length;
Var I = 0;
Var value = 0;
Var temp = "";
For (I; I <size; I ++ ){
Temp = $ (contents [I]). contents (). find ("body" example .html ();
Value + = temp. indexOf ('widget-name = "rating" ', 0 );
}
How does javascript check whether a webpage element contains a specific string?

Function check (CheckStr)
{
Var str;
Str = document. getElementById ("ooo"). innerHTML;
If (str. indexOf (CheckStr) =-1)
Return false;
Else
Return ture;
}

C # determine whether a webpage contains a string

This code is useful. You can use the differences between the two webpages to determine whether the webpage is redirected to the desired webpage. The Code is as follows: reprinted, please specify the Source: using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. windows. forms; namespace determines that the webpage contains a string {public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void Form1_Load (object sender, EventArgs e) {this. webBrowser1.Url = new Uri (& quot;);} private void Button#click (object sender, EventArgs e) {string html = webBrowser1.Document. body. outerHtml; if (html. contains (& quot; minxiangyangwfasg & quot;) {this. label1.Text = & quot; this string exists & quot;} else {this. label1.Text = & quot; this string does not exist!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.