CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.faq_frequently_asked_questions Tags:
Item Type: NewsGroup Date Entered: 5/23/2007 12:48:19 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 7 Views: 155 Favorited: 0 Favorite
8 Items, 1 Pages 1 |< << Go >> >|
sarma_g
Asp.Net User
Clear body with javascript5/23/2007 12:48:19 PM

0

Hi, 

Can we clear whole content inside a body tag using a javascript.

If any one knows Please let me know how it can be.

davidpenton
Asp.Net User
Re: Clear body with javascript5/23/2007 1:17:31 PM

0

Here is a way to do this: 

document.getElementsByTagName('BODY')[0].innerHTML = '';
 
David L. Penton
"Mathematics is Music for the mind, and Music is Mathematics for the Soul. - J.S. Bach"
ca8msm
Asp.Net User
Re: Clear body with javascript5/23/2007 1:18:53 PM

0

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
        function removeHTML()
        {
        document.getElementById('myBody').innerHTML = '';
        }
    </script>
</head>
<body id="myBody" onload="removeHTML()">
    <form id="form1" runat="server">
    <div>
        Test
    </div>
    </form>
</body>
</html>


Mark,
http://aspnetlibrary.com
http://mdssolutions.co.uk - Delivering professional ASP.NET solutions
http://weblogs.asp.net/marksmith


Please remember to click "Mark as Answer" on this post if it helped you.
sarma_g
Asp.Net User
Re: Clear body with javascript5/23/2007 1:58:28 PM

0

Your idea is good but my requirement is changed.

I want to overwrite entire document using javascript function.

Is it possible to do so.

ca8msm
Asp.Net User
Re: Clear body with javascript5/23/2007 2:10:00 PM

0

 You can still use either method that has been suggested to you. Just change the id or the tag depending on which option you go with.


Mark,
http://aspnetlibrary.com
http://mdssolutions.co.uk - Delivering professional ASP.NET solutions
http://weblogs.asp.net/marksmith


Please remember to click "Mark as Answer" on this post if it helped you.
sarma_g
Asp.Net User
Re: Clear body with javascript5/23/2007 4:13:24 PM

0

Hi, i tried your function

what i want is i want to overwrite entire page using javascritp function when any request is made to the server.

When any request is made to server, after server response i want to overwrite the entire page using some javascript ex. doucment.write('<some text here>');

Is it possible to do so.

 Please tell me if any body now how to do.

ca8msm
Asp.Net User
Re: Clear body with javascript5/23/2007 4:40:14 PM

0

 Just set the innrText property like both the examples above show.


Mark,
http://aspnetlibrary.com
http://mdssolutions.co.uk - Delivering professional ASP.NET solutions
http://weblogs.asp.net/marksmith


Please remember to click "Mark as Answer" on this post if it helped you.
sarma_g
Asp.Net User
Re: Clear body with javascript5/23/2007 4:59:03 PM

0

innerText will display the document as  something like follwing  in the page.But i want the html table to be displayed instead of  entire table as text.

 <tr>
                    <td>Edit</td>
                    <td>Delete</td>
                    <td><a id="repeator1_ctl00_lnkName" sortexp="con_fname" href="javascript:__doPostBack('repeator1$ctl00$lnkName','')">Name</a></td>
                    <td><a id="repeator1_ctl00_lnkCity" sortexp="con_city" href="javascript:__doPostBack('repeator1$ctl00$lnkCity','')">City</a></td>
                    <td><a id="repeator1_ctl00_lnkState" sortexp="con_state" href="javascript:__doPostBack('repeator1$ctl00$lnkState','')">State</a></td>
                    <td><a id="repeator1_ctl00_lnkEmail" sortexp="con_email" href="javascript:__doPostBack('repeator1$ctl00$lnkEmail','')">Email</a></td>   
                </tr>
so, now how can i do this one

8 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET AJAX programmer's reference with ASP.NET 2.0 or ASP.NET 3.5 Authors: Shahram Khosravi, Pages: 1522, Published: 2007
JavaScript bible Authors: Danny Goodman, Michael Morrison, Pages: 1236, Published: 2004
JavaScript: A Beginner's Guide Authors: John Pollock, Pages: 550, Published: 2004
Beginning JavaScript Authors: Paul Wilton, Jeremy McPeak, Pages: 767, Published: 2007
DHTML and CSS for the World Wide Web Authors: Jason Cranford Teague, Nancy Davis, Pages: 592, Published: 2001

Web:
[Javascript] document.selection.clear() Sep 23, 2004 ... Previous message: [Javascript] What is this ... document.selection.clear(); }
Clear body with javascript - ASP.NET Forums Clear body with javascript. Last post 05-23-2007 12:59 PM by sarma_g. 7 replies. ... Can we clear whole content inside a body tag using a javascript. ...
javascript clear document - SitePoint Forums javascript clear document JavaScript. ... write(auxstring); write('\n'); } viewstate.document.close(); ...
clearbody() Function [Archive] - CodingForums.com arnyinc. 01-26-2006, 10:00 PM.






newsletter question

how to write such a url for password reset

what is the future of code behind

sending a webpage with embedded images.

can we be able to create a doc file from html tags

secure ftp upload/download to web server ?

how to add multiple code behind files for a aspx page

passing a querry string in a response.redirect?

refresh the content of the page after callback

installed .net 1.1 and iis, .net stuff not being recognized in iis

login via database using vs built-in login component

.net 2.0 v. .net 1.1

fomatting a string to money format

checking against folder content. . .

unauthorizedaccessexception error

setting up ssl certs

passing variables in sub back n' forth?

how to include a c# class in a webform?

what are the stages that happen when a page loads?

htmlencode-htmldecode from a windows application

unable to retreive values using request.querystring

basic question about compiling of asp.net page

how to get rid of those little arrows that appear when you mouse over a table cell in design mode

uploading images

help with extracting the value of a dataset

api, xml, asp.net, vb.net

try previouspagetype for the first time

use httprequest to scan the source-code from an url

edit text that contains html code

call managed code from vb6: assembly or web service

   
  Privacy | Contact Us
All Times Are GMT