| |
Puffin Handbook -- Web Tips and Tricks
How can I center something both vertically and horizontally?
I have a way to do this that I am happy with because no matter how large or small the user's screen or browser window is, this setup will attempt to stay in the middle. Here it is.
<TABLE WIDTH="100%" HEIGHT="100%"><TR><TD ALIGN="center" VALIGN="middle"> This text will be completely centered in the browser window. </TD></TR></TABLE>
This also works for putting things in the bottom corners. Putting things in the top corners I assume you know. Example 1
How can I use other people's sites for my own nefarious purposes?
One way to do that is by faking URL's through scripting. Huh? you say. Well, here we go. I go to http://digital.altavista.com and do a search for "horned puffin" I then check the URL.
http://www.altavista.digital.com/cgi-bin/query?pg=q&what=web&kl=XX&q=horned+puffin
Okay, pretty nasty looking. This is kind of cool by itself. You could have a link like this: Search for Alaskan Puffins But what does a nasty-old URL like that tell me? It tells me I can pass variables to Altavista through the url, which is easy. Well, relatively easy. Now, I can set up a form, something like this.
<FORM ACTION="" NAME="altaform"> <INPUT TYPE="text" NAME="searcher" VALUE="horned puffins"> </FORM> <A HREF="javascript:searchAlta(altaform.searcher.value)">Search<A> <SCRIPT LANGUAGE="javascript"> <!-- function searchAlta(searchText) { var throwaway = replaceString(searchText," ","+"); location.href = "http://www.altavista.digital.com/cgi-bin/query?pg=q&what=web&kl=XX&q=" + searchText; }
function replaceString(mainStr,searchStr,replaceStr) { var front = getFront(mainStr,searchStr); var end = getEnd(mainStr,searchStr); if (front != null && end != null) { return front + replaceStr + end } return null } function getFront(mainStr,searchStr) { foundOffset = mainStr.indexOf(searchStr) if (foundOffset == -1) { return null; } return mainStr.substring(0,foundOffset); } function getEnd(mainStr,searchStr) { foundOffset = mainStr.indexOf(searchStr) if (foundOffset == -1) { return null; } return mainStr.substring(foundOffset+searchStr.length,mainStr.length) } //--> </SCRIPT>
Example 2
How do I put a Real Audio file on my webpage?
Okeydoke.
Go to http://www.realaudio.com and download the latest Real Audio Encoder. Install it, too. Oh yeah, and get the latest player, while you are at it. Meanwhile, if you don't have one already, get a microphone with an eighth inch jack. Plug it into the back of the computer. If you are like me, you will need to try every jack before you get the right one.
|
MAC USER ALERT |
|
The text directly above and below is for IBM PC owners only. I am going to assume Mac users know how to create a sound file, in what will, I imagine, be in aiff file format. However, I really dunno. If you can make a WAV file. great, because that is what I am going to use as an example.
| Right-click on your desktop. Select New->Wav File. Click record. (The little button with the red dot) Say your peace. Sing Puffin the Magic Server. Click stop. Don't worry about the fact that it is a meg or so.
Launch the Real Audio Encoder, and select your Wav file. Encode it. I suggest a 28.8 setting. 14.4 takes a big quality hit. You will create a file with the extension .ra. Upload this file to Puffin. Don't worry if it is still pretty big for a web based file, it will stream, meaning it will be playing as it downloads, in a continuous (in theory) fashion. Now we need to make the .ram file that will point to the .ra file and be in turn pointed to by your HTML document. Got it? Good. The .ram file will consist of a single line of code. here is an example of one.
pnm://puffin:7070/ram_files/fuss.ra
It is set up as follows:
pnm://puffin:7070/
| Just leave this part. |
/ram_files
| Replace this part with the name of your folder. |
/fuss.ra
| Make this the name of the .ra file you made and uploaded to your folder |
Upload this file to the server, as well, and make a hyperlink to it from your webpage. Example 3
©1998 PTI NET Alaska, All Rights Reserved email The Puffin with comments, criticisms, and concerns.
| |