Posts

Showing posts from June, 2004

JavaScript: Open Image Links in Popup

The following script makes all links to images open in a popup window. No inline JavaScript required. Modern browser required (i.e. IE5+, NS 6+, Mozilla Firefox). Save into scripts directory and include on page by adding into page <head> tags: example.html <html> <head> <title>Popup Image Example</title> <script type="text/javascript" src="scripts/imagepop.js"></script> </head> <body> <p><a href="images/foo.gif" title="Foo Title" width="120" height="300">Foo</a> | <a href="images/bar.jpg" width="140" height="280">Bar</a> | <a href="page.html">Baz</a></p> </body> </html> scripts/imagepop.js function imagepop(url,title) { // new window title var contents = '<html><head><title>' + ((title)?title:'Image Popup') + '

CSS: min-width and min-height with Internet Explorer

Combining the underscore hack with the ability of IE to evaluate expressions in CSS, you can set the minimum/maximum width and minimum height of an HTML element using CSS: div.content { background: #eee; /* minimum height */ min-height: 400px; /* auto height for compliant browsers */ height: auto; /* min-height for IE browsers */ _height: 400px; /* minimum width */ min-width:300px; /* IE Dynamic Expression to set the width */ width:expression(document.body.clientWidth < 300 ? "300px" : "100%" ); /* maximum width */ max-width:600px; /* IE Dynamic Expression to set the width */ width:expression(document.body.clientWidth > 600 ? "600px" : "100%" ); } This makes sure that the DIV element this is applied to is at least 400px high and 300px wide and at most 600px wide. This is a combination of Imposing Minimum Width With CSS and The Underscore Hack .

Browser Capabilities Project

The Browser Capabilities Project is a site where you can get an updated Browscap.ini file that is used for getting the capabilities of the browser that the site visitor is using - so you can check to see if a certain feature is supported - JavaScript, VBScript, Cookies, Tables etc. The above does not work with ASP.NET, but there is a way to do it by editing your machine.config or web.config files. Details

Underscore Hack (CSS)

A useful hack for serving up CSS that only Internet Explorer for Windows can interpret (i.e. to fix various bugs). Other browsers simply ignore the property. Useful for working round the position:fixed and min-height issues, as well as any others that require CSS that is only interpreted on Windows IE.

ASP.NET Poll Web Control

A useful ASP.NET web control for adding polls to an ASP.NET driven site. Free to use, supports SQL and Access databases. Fairly customisable and the API is documented.

MyGeneration SharpDevelop Project Template (C# version)

C# version of my previous template for MyGeneration. Save in the same directory as generated C# dOOdads entities. Set namespace to same one that was used to generate the dOOdads entities. Also MyGeneration.dOOdads.dll has to be placed in the bin\Release subfolder - i.e. My Documents\SharpDevelop Projects\My Project\bin\Release Interface Code: Dim cmbDatabases Dim lstTables Sub setup() If Not input.Contains("lstTables") Or Not input.Contains("txtPath") Then ui.Title = "Generate C# SharpDevelop Project" ui.Width = 330 ui.Height = 450 ' Grab default output path Dim sOutputPath sOutputPath = "" If input.Contains("defaultOutputPath") Then sOutputPath = input.Item("defaultOutputPath") End If ui.AddLabel "lblPath", "Output file path: ", "Select the output path." ui.AddTextBox "txtPath", sOutputPath, "Select the Output Path.&quo