HomePage | Optical Illusions | War Stories | QBasic | Dads Navy Days | Bristol | Bristol, USA | Bristol, Canada | Terre Haute | Miscellany | Web Stuff | About Ray | Site Map | Site Search | Messages | Credits | Links | Web Rings

Web Stuff | Audio | Basics | Browser | Code Tips | Design | Fonts | Forms | Frames (Page 1), (Page 2) | Images (Page 1), (Page 2) | Links | Random | Redirection | Sound | Video | Search Engines | Lycos UK | Home Server (Page 1), (Page 2), (Page 3)

When copying the code from these pages remember to paste them first into a text only editor such as Notepad and then copy and paste from there into your webpage. This is so that all the text formatting codes can be removed from the copied text. Remember that your HTML editor must be in code or HTML view when you paste the code into it. If you are using a template driven HTML editor then the code must be pasted into an HTML and not a text box. JavaScript must be enabled in your browser for the effects generated by it to be seen.

Code Tips

How do I stop the adverts my host puts on my site?

Reusing code on multiple pages

Fonts

Display specific fonts - HTML

Code Tips :

How do I stop the adverts my host puts on my site?

Here's a list of sites that may be able to help you, some haven't been updated for a while though.

If you use any of the codes provided remember that your host may well disable your site or delete your account altogether.

Best Scripts

Cexx

Cexx Boards

Gameconn

A lot has been written about web design and standards. My own opinion is it's your site so you can make it look how you like. Be sure to make the pages navigable though and keep clear of site designs like Webtek Systems - no-one's site should look like this.

Writing the pages on your own computer means that you can test them before uploading them to the server. If you make the layout of the site the same on your computer as it is on the server there is less chance of files being uploaded to the wrong place.

To get the files from your computer you'll need a FTP program. FTP stands for File Transfer Protocol and is a program and a method to transfer files from one computer to another. I use SmartFTP but there are loads of others available. Some hosts don't let you use FTP directly but make you use a FTP uploader. These are fine, but usually limited in some way.

Reusing code on multiple pages

Suppose you want to want a piece of text or an image to appear on a page multiple times or even on multiple pages. There are a couple of ways you can accomplish this. You could always use the same code over and over but even cutting and pasting that would be duplicating the effort. A much simpler way would be to use JavaScript.

Write the code that you want repeated in a plain text editor such as Notepad. Here's an example ...

<p align="center"><img src="unionjack.gif" alt="Union Jack" align="middle" width="200" height="100"></p>
<p align="center">The British and American flags</p>
<p align="center"><img src="usflag.gif" alt="Old Glory" align="middle" width="200" height="100"></p>

Use the JavaScript document.write syntax to encase the text ...

document.write('<p align="center"><img src="unionjack.gif" alt="Union Jack" align="middle" width="200" height="100"> </p>');
document.write('<p align="center">The British and American flags</p>');
document.write('<p align="center"><img src="usflag.gif" alt="Old Glory" align="middle" width="200" height="100"> </p>');

In case you have trouble seeing it, the syntax is ...

document.write('Whatever you want here');

Save the text file with a .js extension, in this example I'll call it flags.js

Where you want the code to appear on your page(s) simply put a reference to it, like this ...

<script language="JavaScript" type="text/javascript" src="flags.js"></script>

In this example, the following result is achieved ...

If you need to change the code, then rather than change the code on all the different pages then you simply edit the .js file.

If you want an image to appear on multiple pages, but may want to change the image at some time in the future then place the image code on each of the pages but use a generic name such as logo.gif. If you want to change the image, just upload a new image with that name. However, if the image needs to be resized then you'll have to edit the code wherever it appears.

One prime candidate for using JS files like this is for menus. As you add more pages to your site it's far easier to have the menu's in one reusable file rather than have a copy of the menu on each page. There are several ways of using the menu, depending on how you want your page to display. The following examples use files named jsmenu1.js and jsmenu2.js

The following code uses jsmenu1.js and shows a menu suitable for adding to a page, even in a table cell that runs down the page.

The following code uses jsmenu2.js and shows a menu suitable for adding to a page, even in a table that runs across a page.

If you've Common Gateway Interface (CGI) access then you've many choices about which language to use. A lot of hosts don't allow CGI access because of security concerns but if they do you should be able to write CGI scripts in whatever language you like. See http://www.jayeckles.com/cgi/language.html for an article on what to use.

Perl is pretty commonly used and uses a simple PRINT command to get text into HTML pages. See http://www.pageresource.com/cgirec/ptut2.htm for how to write a simple Perl script. Using CGI should be better than JavaScript, because depending on the language it should be faster than JavaScript. It is also faster because the processing is done on the server so only the finished HTML pages are served. With JavaScript both the HTML and .JS files have to be downloaded to the client, the processing speed (negligible in simple cases) depends on the client computer and JS has to be enabled on the client machine. JS is however slightly simpler to implement and test.

Using server or client side code aren't the only methods. You can use frames or iframes to display one or more HTML pages inside another. Personally, I don't like frames, badly coded frames mean that ...

1) You cannot go directly to a bookmark on a page by typing the full URL in the browser address bar.

2) Every page shows the same URL, the one that you entered the site on.

3) Because of 2) the browsers back and forward navigation buttons no longer work properly.

4) Because of 2) the browsers refresh button does not work properly

5) External links often open inside a site's frame structure.

Far better are iframes. These address the problems caused by frames and I find them very much better.

Here's the code to produce the iframe ...

<p align="center"><iframe name="I1" src="imenu.htm" width="90%" height="10%">
Your browser does not support inline frames or is currently configured not to display inline frames.</iframe>

The menu displayed in the iframe is a simple HTML page named imenu.htm This is a normal HTML page. To make the links open in the main browser window then write the link in the form

<a href="web1.htm" target="_parent"> or <a href="web1.htm" target="_top">

If you don't include target="_parent" or target="_top" the page that you link to will open inside the iframe - something that is probably not a good idea. If you're really masochistic then click on the link "Don't click here!" in the iframe below. You can get back to normal by clicking on the browser back button.

Here's what happens if you don't include target="_parent" or target="_top" in the HREF tag - the page opens - but inside the iframe!

What happens if you don't include target="_parent" or target="_top" in the HREF tag

If you don't like the "sunken" look of the iframe then add frameborder="0" to the code for it. The code then becomes

<p align="center"><iframe name="I1" src="imenu.htm" width="90%" height="10%" frameborder="0">
 Your browser does not support inline frames or is currently configured not to display inline frames.</iframe>

and the iframe now looks like this ...

If you use a free host that places adverts on your pages there is a disadvantage of opening a new HTML file like this. Most hosts dynamically add the advert code as the page is loaded, which means that the menu, or other page, you load into a frame or iframe are also going to contain the advert, which may confuse your visitors.

A hosts adverts on a HTML menu page

One way around this is to add a bookmark near your menu, or other text you want displayed and alter the link to the page to go to that bookmark. Bookmarks are added to a page by using...

<a name="Here"></a>

Where "Here" can be any text you like.

The code to call the page and display it starting at the bookmark is

<p align="center"><iframe name="I1" src="imenu.htm#Here" width="90%" height="10%" frameborder="0">
 Your browser does not support inline frames or is currently configured not to display inline frames.</iframe>

This code can have some odd side-effects. For some reason not only does the HTML page called in the iframe go to the specified bookmark, but the main page does as well.

It may take a little fiddling with the spacing on the linked page and the dimensions of the iframe to get it looking exactly as you want.

Fonts: - Display specific fonts - HTML

Webpage authors may specify in their HTML what font they may like their page to display by using the font tag. For example:

<p><font size="4" color="#0000FF" face="Arial">This is Arial</font></p>

This will display This is Arial but only if the Arial font is installed on the users computer. If you need a specific style of font displayed then the following should be used:

<p><font size="4" color="#0000FF" face="Arial, Antigoni, Tahoma">This is a san serif font</font></p>

What this does is give the viewers computer a choice of fonts to use. If Arial isn't installed, then Antigoni will be looked for. If that isn't installed then Tahoma will be used. If none of the fonts are available then the default font (usually Times Roman) will be used.

If a certain font must be used then it may be better to create an image using the font you want displayed. The "Web Stuff" image at the top of this page was created using a graphics program, the font used was BrushScript BT at 106pt. The background was then turned transparent.

There are several technologies that let you display fonts as you intended ...

CSS allows the same lists of fonts to be used as in HTML, CSS2 allows for the downloading of fonts to the client machine.

You can also use Flash and PDFs which allow you to display text exactly how you intended.

WEFT, TrueDoc or OpenType download the fonts when they are required. None of these technologies are very popular at the moment.

There's a nice tutorial about embedded fonts at http://hotwired.lycos.com/webmonkey/design/fonts/tutorials/tutorial2.html

 

Web Stuff | Audio | Basics | Browser | Code Tips | Design | Fonts | Forms | Frames (Page 1), (Page 2) | Images (Page 1), (Page 2) | Links | Random | Redirection | Sound | Video | Search Engines | Lycos UK | Home Server (Page 1), (Page 2), (Page 3)

HomePage | Optical Illusions | War Stories | QBasic | Dads Navy Days | Bristol | Bristol, USA | Bristol, Canada | Terre Haute | Miscellany | Web Stuff | About Ray | Site Map | Site Search | Messages | Credits | Links | Web Rings

This page created 2nd March 2004, last modified 28th December 2004


GoStats stats counter