Design4Online Home
Web Design Services
Downloads and Freebies
Portfolio of Work
Contact Design4Online

Code Snippet Downloads

The following snippets of code will only work in Active Server Pages being run from a Windows server.

ASP Automatic Year Value (ASP Code)

This code is useful for using within a copyright e.g. © 2001 - 2005 (where used for the 2005 value, the year date will always be the current year).

Source Code:

<% =Year(Date)%>

 

JavaScript Close Window and Refresh Parent Window (JavaScript Code)

This code will close the window it is placed in and refresh the "opener" page. Useful for when you have updated a recordset in a pop-up window and wish to refresh the main page containing the short list of records. Place the following code within the body of the page you want closed i.e. the page that is loaded once the update has been completed.

Source Code:

<SCRIPT language="JavaScript" type="text/javascript">
<!--
opener.location.reload(true);
self.close();
// -->
</SCRIPT>

 

Export Page Recordset as Excel (ASP Code)

This code will prompt the viewer to download an Excel file, produced from the recordset that is on the page. Place the code above the HEAD content within the file of your recordset. To produce easily read results in the exported Excel sheet, you should not link any custom styles or style sheets to the page and table within your recordset page.

Source Code:

<%
Response.ContentType="application/x-msexcel"
%>

 

No Margin on Form (CSS Code)

Adding this code to your page style or style sheet, will allow forms to have no margin. By default, HTML renders forms with a certain amount of space around them. To overcome this, you can specify the style of the form within the CSS properties. It is useful when you want a form field in a narrow bar, such as a search form at the top of the page, inline with other text.

Source Code:

.form { margin-top: 0; margin-bottom: 0;
}

 

More coming soon....

 

Downloads

Download Adobe Acrobat Reader

Scrribble