Save the page with js content specified. Specified file type



Save the page with the specified content js

Transfer from: http://rorchina.javaeye.com/blog/184425

<script language=javascript>   

function Save(){   
    var txt = document.all.output.value;
    b = window.open();  
    b.document.open();  
    b.document.write(txt);  
    b.document.close();
    b.document.execCommand('saveas',true,'output.html');
    b.window.close();
}

</script>
 


<center> Save only the text box portion:  </center>
<table width="90%" align="center" border="0" cellpadding="0" cellspacing="0"> 
    <tr> 
		<td> Do not save  </td> 
		<td><input type="button" value="Save">

		<textarea rows="20" cols="50"></textarea>
		</td> 
    </tr> 
</table>


Saved in HTML in the Table to Excel

Transfer from: http://www.bcbbs.net/news/Content28841.aspx

<html> 
  <head> 
     <title> Save a Table in HTML to Excel  </title> 
  </head> 
  <body> 
     <h1> To save the content into Excel  </h1> 
     <table> 
         <tr><td> Column 1  </td><td> Column 2  </td></tr> 
         <tr><td>a1</td><td>a2</td></tr> 
         <tr><td>b1</td><td>b2</td></tr> 
         <tr><td>c1</td><td>c2</td></tr> 
         <tr><td>d1</td><td>d2</td></tr> 
         <tr><td>e1</td><td>e2</td></tr> 
         <tr><td>f1</td><td>f2</td></tr> 
     </table> 
      <a href="javascript:downloadfile('content')"> Save the file  </a> 
    <script language="javascript"> 
       function downloadfile(id)  
      {  
              window.document.write(document.getElementById(id).outerHTML);  
              window.document.execCommand("SaveAs",false,"C:\\download.xls");  
              history.go(-1);  
      }  
    </script> 
  </body> 
</html>  


  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Save the page with js content specified. Specified file type

  • Hibernate primary key strategy-sequence

    Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...

  • hibernate call stored procedure

    hibernate call stored procedure

  • hibernate using c3p0 connection pooling

    Private http://www.lifevv.com/tenyo/doc/20070605102040991.html c3p0 for open source's JDBC connection pool, with the release hibernate. This article describes how to use the hibernate configuration in c3p0. c3p0 connection pool configuration is v ...

  • Hibernate configuration parameters hibernate.hbm2ddl.auto

    Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...

  • Build flex + spring + blazeds + hibernate application

    Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.1 ...

  • hibernate generic generic DAO

    hibernate generic generic DAO

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Hibernate secondary cache

    Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...

  • Hibernate's lazy strategy

    hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...

Leave a Reply

Recent
Recent Entries
Tag Cloud
Random Entries