0

Hi all,

Can anyone explain how to parse a html file at the client side that we got as a response from the server?
Please provide me good websites for doing this task.

Thanks in advance.

Dave.
:)

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by kceleb9
0

hi buddy

Here is my explanation:

I will get a html response from a server when I click a button at the client side.Now that html file should be displayed in the client side with font,style,color every thing applied as per the client side.
I want to do in java script.Am able to display the html file by using the following js function:

function getBody(content) 
	{
	   test = content.toLowerCase();    // to eliminate case sensitivity
	   var x = test.indexOf("<form");
	   if(x == -1) return "";

	   x = test.indexOf(">", x);
	   if(x == -1) return "";

	   var y = test.lastIndexOf("</form>");
	      if(y == -1) y = test.lastIndexOf("</html>");
	   if(y == -1) y = content.length;    // If no HTML then just grab everything till end

	   return content.slice(x + 1, y);   
	}

and

if(req.readyState == 4)
		{
				main.innerHTML = getBody(req.responseText);
		}

But the formatting is not proper at the server side and we at the client side should do it...I want to know how to format html response, add breaks wherever needed at the client side.

I think I have explained a bit specific....

Regards
Dave.

0

You are saying you have a separate client software application - not a browser - that has a javascript engine? You want to display the HTML "per the client side"

Why not just use a browser - if you are interested in displaying HTML? What other requirements to do you have for how the HTML is rendered?

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.