Discussion Forum

Welcome to the Discussion Forum, we encourage you to REGISTER on our forum and participate in the debate.For more details Click here

Online Advertising

Viewers now you can promote Your Websites/Blogs/Products by using our online advertising program.Using this feature you can place your Ads in my blog and can attract the people logging over here.To place your ads, just sign in my Guest Book and leave your details over there.

Monday, March 30, 2009

Webload script to count the occurance of searched string

Scenario:
1.Open the Google search site
2.Search with keyword "testing"
3.Need to count the number of occurance of string "Cached" in the Searched result page of google
Use the script below to complete the above scenario,
function countString ( SearchForStr, msg, count )
{
i = 0;
msg = document.wlSource
do
{

offset = msg.indexOf(SearchForStr)

if (offset == -1)
{
return i;
}

l = SearchForStr.length;

offset = offset + l;
msg = msg.substring(offset,65535);
i++;

}
while (i <= 65535)
}

SearchForStr = "Cached"
count = 0
x = countString (SearchForStr, msg, count )
InfoMessage(x)

x - is the count for the number of times searched string occurs.

No comments:

Post a Comment

Free advertising


Lowes Coupon
How to Blog

Free Advertising