some common used tips in web development
2005-07-13 13:57
573 查看
Been working on the post-production phase in a web project recently, and some features can be really nice to have..
1. Prevent duplication form post when you insert a new record.
http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=98
<SCRIPT language=JavaScript >
var submitcount=0;
function checkSubmit()
{
if (submitcount == 0)
{ submitcount++; return true; }
else
{ alert('This form has already been submitted.' ); return false; }
}
</SCRIPT>
<form name=frmSubmit method=post onSubmit=" return checkSubmit();" action="mypage.asp" >
2. A simple progress bar to wait the next page...
http://blogs.crsw.com/mark/articles/642.aspx
http://blogs.crsw.com/mark/samples/BusyBoxDemo/Default.aspx
All that is need for this page is:
- a single line of code to reference the busy box javascript.
- a small javascript statement in the body tag's onbeforeunload event.
- a small iframe tag.
- a single line of code to instantiate our busy box object.
- a BusyBox.htm file to reference (or any name you like).
3. Open IIS6 compression to make asp.net faster
you need to manually modify the iis6 config file, just following through the links
http://www.dotnetdevs.com/articles/IIS6compression.aspx
http://support.microsoft.com/?id=322603
4. Make the block collapsable
example is in a custom control format
//this is the javascript function to be emitted.
private string getJsScript()
{
StringBuilder sb = new StringBuilder();
sb.Append("<script>\n");
sb.Append("function collapse(id){\n");
sb.Append("var ul = document.getElementById(id);\n");
sb.Append("ul.style.display = (ul.style.display == \"block\") ? \"none\" : \"block\";\n");
sb.Append("}\n");
sb.Append("</script>");
return sb.ToString();
}
//release the javascrip
protected override void OnPreRender(EventArgs e)
{
Page.RegisterClientScriptBlock("collapseScript", getJsScript());
base.OnPreRender(e);
}
//in the create control function add the javascript function call when click
protected override void Render(HtmlTextWriter writer)
{
this.EnsureChildControls();
string ulId = "leftmenusep";
writer.AddAttribute("src", CollapseIconLocation);
writer.AddAttribute("onclick", String.Format("javascript:collapse('{0}');", ulId));
writer.RenderBeginTag("img");
writer.RenderEndTag();
}
1. Prevent duplication form post when you insert a new record.
http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=98
<SCRIPT language=JavaScript >
var submitcount=0;
function checkSubmit()
{
if (submitcount == 0)
{ submitcount++; return true; }
else
{ alert('This form has already been submitted.' ); return false; }
}
</SCRIPT>
<form name=frmSubmit method=post onSubmit=" return checkSubmit();" action="mypage.asp" >
2. A simple progress bar to wait the next page...
http://blogs.crsw.com/mark/articles/642.aspx
http://blogs.crsw.com/mark/samples/BusyBoxDemo/Default.aspx
All that is need for this page is:
- a single line of code to reference the busy box javascript.
- a small javascript statement in the body tag's onbeforeunload event.
- a small iframe tag.
- a single line of code to instantiate our busy box object.
- a BusyBox.htm file to reference (or any name you like).
3. Open IIS6 compression to make asp.net faster
you need to manually modify the iis6 config file, just following through the links
http://www.dotnetdevs.com/articles/IIS6compression.aspx
http://support.microsoft.com/?id=322603
4. Make the block collapsable
example is in a custom control format
//this is the javascript function to be emitted.
private string getJsScript()
{
StringBuilder sb = new StringBuilder();
sb.Append("<script>\n");
sb.Append("function collapse(id){\n");
sb.Append("var ul = document.getElementById(id);\n");
sb.Append("ul.style.display = (ul.style.display == \"block\") ? \"none\" : \"block\";\n");
sb.Append("}\n");
sb.Append("</script>");
return sb.ToString();
}
//release the javascrip
protected override void OnPreRender(EventArgs e)
{
Page.RegisterClientScriptBlock("collapseScript", getJsScript());
base.OnPreRender(e);
}
//in the create control function add the javascript function call when click
protected override void Render(HtmlTextWriter writer)
{
this.EnsureChildControls();
string ulId = "leftmenusep";
writer.AddAttribute("src", CollapseIconLocation);
writer.AddAttribute("onclick", String.Format("javascript:collapse('{0}');", ulId));
writer.RenderBeginTag("img");
writer.RenderEndTag();
}
相关文章推荐
- Some useful tools in web development
- Some useful tools in web development
- .NET错误The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework
- Some tips of wmi scripting in jscript (1)
- Semantic Web Development in China
- selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH
- selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PAT
- Some Tips/Tricks in Machine Learning
- [Tip: C# in VS]Some quick tips for working on C# in VS
- need to set default value for Webservice's if it's used as datasource displayed in Moss
- selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH
- Some commonly used commands in linux
- some tips about web hacking
- Some tips of wmi scripting in jscript (1)
- Website, Web software and Mobile solutions Development Service Provider in China
- Beginning POJOs: Lightweight Java Web Development Using Plain Old Java Objects in Spring, Hibernate,
- Some tips in Html
- Some Common Tasks in Task Order
- Selenium WebDriver – Common Used API
- Some tips in using Xcode