Dr Design Answers your Questions

After a very long hiatus, Dr. Design is back! He’s found his stethoscope, donned a white coat, and is now seeing patients. So if your layout’s ailing, you’ve got a chill in your PNGs, or you need a little something for those troublesome stylesheets, why not seek a consultation? The good Doctor is in!

Finicky Frames

Dear Dr. Design,
I have a site that uses frames. I’m able to change the content of a single frame when a user clicks a link. But now I want to know how I can change the content in multiple frames when the user clicks a single link. Can you help me?

As I’m sure you’re aware, most frame links look something like this:

<a href="hello.html" target="main">my link</a>

By using a bit of smart JavaScript like this:

<script language="javascript" type="text/js"> 
<!--

function doSwitch(frame1,frame2,frame1loc,frame2loc)
{
top.frame1.location.href=frame1loc;
top.frame2.location.href=frame2loc;
}

// -->
</script>

you can reuse the code. This allows you to do stuff like:

<a href="doSwitch('main','top','main.asp','top.asp');"> test</a>

Let’s just step back a second here. There’s no need to adjust the JavaScript. The only aspect that’ll change is the code inside doSwitch(). By using encapsulated JavaScript like that above, we save ourselves needing to write a function for each and every link.

Make default.asp Your Main Page

Dr. Design, I’m using ASP on an NT server and was wondering if there was an easy way I could make default.asp the main page that loads (instead of index.html or .htm)? Do I need to contact my host, or is there a way I can do this automatically?

This is a great question — though the answer may not be what you expected. Many hosts employ very strong Control Panels, which can often be found at www.mydomain.com/cp or some similar address. If your host either does not have a Control Panel, or the Control Panel does not give you the option to specify Default Home Pages, you need to contact them in order to effect the change.

Because of the way Internet Information Server is set up, there is a list of default pages it looks for whenever a directory (www.mydomain.com/mydirectory) is accessed without a specified file. IIS maintains a list (set up by your host) of the files which are "allowed" to be Default Home Pages. Setting this up is actually a fairly simple task, but the fact that your default.asp page isn’t showing up suggests you will need to contact them in order to ask them to add it to the list. It’s literally a 20 second job. Good luck!

ASP Resources

Hey Dr. Design, is there such a thing as an ASP manual (sort of an equivalent to the PHP manual for ASP)? What are some good resources for learning ASP?

I’ll defer this question to the members of the SitePointForums, as they’ve amassed an amazing list of resources. I think this list is about as complete as can be, and I’d recommend that you save this somewhere handy.

General ASP Sites

Though there are literally thousands of ASP-based sites around, here’s a list of our favorites — they’re the most comprehensive and useful.

Microsoft Links

As the developer of ASP, Microsoft has provided a veritable treasure trove of resources, chief among which is the Microsoft Developers Network (MSDN). These documents can be confusing, but are worth digging through.

Miscellaneous MS Database Links

Several especially important parts of the MSDN are those related to Microsoft’s databases. Here are a few important aspects:

ASP Documentation

ASP Documentation is available with every full install of Microsoft Internet Information Server. It is viewable through http://localhost/iishelp if this is installed. If not, check your installation options. Though Microsoft Personal Web Server does allow ASP, and does provide ASP documentation, it can be both sparse and inaccurate.

Popup Window Woes

Help me, Dr. Design! Popup windows may seem simple to some, but to me they are an absolute pain… Is there an easy way to make them?

Yes! Builder.com’s Window Builder is just what you need. It allows you to specify your settings to find the perfect combination for you. You can then simply cut and paste the code into your HTML page! I use it all the time…

Coloured Scrollbars Are Easy

Doc, I’ve seen coloured scrollbars on many sites, but I have no idea how to create them! Any ideas?

It’s very simple, and it’s done using CSS. CSS allows us as designers to do all kinds of things that were previously impossible using HTML. Here’s the code you’re looking for!

BODY  
{  
scrollbar-face-color: #738A8C;  
scrollbar-shadow-color: #738A8C;  
scrollbar-highlight-color: #738A8C;  
scrollbar-3dlight-color: #738A8C;  
scrollbar-darkshadow-color: #738A8C;  
scrollbar-track-color: #ffffff;  
scrollbar-arrow-color: #ffffff;  
}
Stop My Background Moving!

Dr. Design, on many Web pages I’ve seen these backgrounds that don’t move. How is this done?

There are two ways to create this effect, but before I show them to you, let me encourage you to use them in moderation. Much like a clock that flies around the screen, using fun effects can easily cross the line from attractive to amateurish. Be sure to use this one carefully, and only when appropriate!

Our first example uses CSS. Personally I prefer this method as I can link to it via an external style sheet and maintain control over my whole site from one file.

BODY  
{  
background-image: url(starbackground.gif);  
background-repeat: no-repeat;  
}

In the above example I’ve added an extra line of code to give you more power. The background-repeat property will allow you to either have the image occur only once (like a classy watermark), to have it repeat only horizontally (by changing the no-repeat to x), or vertically (by changing the no-repeat to y).

There is another simple way to create this effect, using the following code:

<body background="images/mainback.jpg" bgproperties="fixed">
HTML to Word Document Conversion

Dr. Design, is there any quick and easy way to turn HTML documents into Word documents? If it’s helpful, I have ASP installed on my Web hosting account.

Good question! Often the Web can be such a pain to work with in terms of data collection and getting people to fill out forms online. Streaming data to our users in different formats than HTML is a great idea.

Using MIME and Content-types we are able to stream data to our users as if it were something other then HTML. In the example below, we’ll stream data to your users as if it were a Word file.

<%  
Response.ContentType = "application/msword"  
%>

This is a great technique. However MS Word is not the only format in which you can stream data. Here’s a sampling of just a few others:

  • "text/plain"
  • "text/html"
  • "application/pdf"
  • "text/richtext"
  • "text/xml"
  • "application/wordperfect"
  • "application/mswrite"
  • "application/msexcel"
  • "application/msword"
  • "application/mspowerpoint"
  • "text/vnd.wap.wml"
  • "text/vnd.wap.wmlscript"
  • "image/vnd.wap.wbmp"

Spread the love!
Dr. Design

Many thanks to this week’s patients. The Dr. Design consulting rooms will open again at the same time next week, but you can contact the Doctor with your design ailments at any time, and he’ll answer them here at SitePoint.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

No Reader comments

Comments on this post are closed.