Page 1
VI, March 2005
Introduction to HTML
(adapted from Laurent Falquet)
2005
Introduction to HTML (adapted from Laurent Falquet) 2005 VI, March - - PowerPoint PPT Presentation
Introduction to HTML (adapted from Laurent Falquet) 2005 VI, March 2005 Page 1 Outline Tags, structure Definitions Text formatting HTTP, MIME, URL... Tables Images History Links Forms, example Browsers
Page 1
VI, March 2005
(adapted from Laurent Falquet)
2005
Page 2
VI, March 2005
Page 3
VI, March 2005
Page 4
VI, March 2005
Page 5
VI, March 2005
www.expasy.org 129.194.8.64 *.org dns.anywhere.net client.anywhere.net www.expasy.org ??
Page 6
VI, March 2005
Page 7
VI, March 2005
Page 8
VI, March 2005
Page 9
VI, March 2005
The <B>bold</B> word
<IMG src="../images/logo.gif" height=’320’ width=‘576’>
<TITLE>titre de la page </TITLE>
<FRAMESET> <FRAME> </FRAMESET>
minimal tags:
Page 10
VI, March 2005
<html> <header>…</header> <frameset cols="162,*" border="0" framespacing="0"> <frame src="Gauche.html" name="Gauche" noresize scrolling="NO"> <frame src="Droite.html" name="Droite" noresize> </frameset> <noframes> <body> … </body> </noframes> </html>
Page 11
VI, March 2005
What's wrong with frames? … In depth Unaddressable resources On the Web, everything can be accessed (or addressed, at least) using an Uniform Resource Locator (URL). This makes it possible to link to anything, anywhere. At least, as long as the anything in question does not use frames. Totally incompatible The general rule for HTML is that if an element is not understood by a browser, it should be ignored. This way, a browser that does not understand the element can still show the rest of the document. The reader may miss some of the meaning of the text, or get a document that is formatted a bit strangely. Unfortunately, this is not the case with frames. The FRAMESET and FRAME elements do not have textual content. A browser that does not support frames will simply skip over these tags. But as there is nothing else to show, this browser would display nothing in place! The NOFRAMES element allows an author to specify content for such a browser, but this often means that the author has to do double work.
Page 12
VI, March 2005
<UL> UL> <LI>first <LI>first line</LI> line</LI> <LI>second <LI>second line</LI> line</LI> <LI>last <LI>last line</LI> line</LI> </UL> </UL>
Page 13
VI, March 2005
<TABLE BORDER=1> <CAPTION>A test table with merged cells</CAPTION> <TR><TH ROWSPAN=2><TH COLSPAN=2>Average<TH ROWSPAN=2>other<BR>category<TH>Misc <TR><TH>height<TH>weight <TR><TH ALIGN=LEFT>males<TD>1.9<TD>0.003 <TR><TH ALIGN=LEFT ROWSPAN=2>females<TD>1.7<TD>0.002 </TABLE> A test table with merged cells /--------------------------------------------------\ | | Average | other | Misc | | |-------------------| category |--------| | | height | weight | | | |-----------------------------------------|--------| | males | 1.9 | 0.003 | | | |-----------------------------------------|--------| | females | 1.7 | 0.002 | | | \--------------------------------------------------/
CAPTION - Table caption TR - Table row TH - Header cell TD - Table cell
Page 14
VI, March 2005
(http://www.isb-sib.ch)
Page 15
VI, March 2005
Page 16
VI, March 2005
<IMG src="../images/logo.gif" height=‘320’ width=‘576’>
transparency, animated, (logos, flat colors)
interlacing or transparency, static, (photographic images)
transparency, static, smaller files
Page 17
VI, March 2005
<A HREF="#nextchapter">click here</A> ...Some HTML code... <A name="nextchapter"></A>
<A HREF="http://www.expasy.ch"> click here</A>
<A HREF="mailto:jean@isb.ch"> click here</A>
<IMG width="48" height="24" src="../images/map.gif" usemap="#anymapname"> <MAP name="anymapname"> <AREA href="otherpage.html" coords="33,2,43,22" shape="rect"> </MAP>
Page 18
VI, March 2005
<FORM name="FormName" action="/cgi-bin/dea-test.pl" method="post"> ...Some HTML code... ...With form tags... </FORM>
GET or POST ? (with the Get, all the form data is included in the URL. So we can directly access this program without the form, by using the following URL:
http://www.expasy.org/cgi-bin/mailform/Swiss-Prot_Helpdesk&&swiss-prot@expasy.org )
Page 19
VI, March 2005
Page 20
VI, March 2005
<html html> <head head> <meta meta http-equiv="content-type" http-equiv="content-type" content="text/html;charset=iso-8859-1"> content="text/html;charset=iso-8859-1"> <meta meta name="generator" name="generator" content="Adobe content="Adobe GoLive GoLive 4"> 4"> <title title>DEA: >DEA: Example Example of
a form< form</title /title> </head /head> <body body bgcolor="#afeeee"> bgcolor="#afeeee"> <center center> <form form name="FormName" name="FormName" action="/cgi-bin/dea-test.pl" action="/cgi-bin/dea-test.pl" method="post"> method="post"> <h1 h1>Example >Example of
a form form :< :</h1 /h1> <hr hr width="580"> width="580"> <p>< ><b>Your >Your name:< name:</b /b> > <input input type="text" type="text" name="nom" name="nom" size="24"> size="24"> <b>Your >Your password:< password:</b /b> > <input input type="password" type="password" name="motdepasse"size="24"> name="motdepasse"size="24"> </p /p> <p>< ><b>Your >Your sex:< sex:</b /b> male< male<input input type="radio" type="radio" value="homme" value="homme" name="sexe"> name="sexe"> female< female<input input type="radio" type="radio" value="femme" value="femme" name="sexe"> name="sexe"> <b>Your >Your university:< university:</b /b> <select select name="universite" name="universite" size="1"> size="1"> <option
value="empty" selected>select selected>select please please <option
value="unibas">Basel <option
value="unige">Geneva <option
value="unil">Lausanne </select /select> </p /p>
Page 21
VI, March 2005
<p>< ><b>Your >Your interests:< interests:</b /b> <input input type="checkbox" type="checkbox" value="biochimie" value="biochimie" name="interets">biochemistry name="interets">biochemistry <input input type="checkbox" type="checkbox" value="scrabble" value="scrabble" name="interets">scrabble name="interets">scrabble <input input type="checkbox" type="checkbox" value="bouffe" value="bouffe" name="interets">food name="interets">food <input input type="checkbox" type="checkbox" value="voiture" value="voiture" name="interets">cars name="interets">cars <input input type="checkbox" type="checkbox" value="autre" value="autre" name="interets">other name="interets">other </p /p> <p> <input input type="submit" type="submit" name="submitButtonName" name="submitButtonName" value="send value="send data data to to cgi- cgi-bin"> bin"> <input input type="reset"> type="reset"> </p /p> </form /form> <p> <hr hr width="580"> width="580"> </center /center> </body /body> </html /html>
Page 22
VI, March 2005
Page 23
VI, March 2005
use CGI; $cgi=new CGI; my $seq=$cgi->param(’sequence'); my @database=$cgi->param('database');
use CGI::Carp q(fatalsToBrowser);
use CGI::Lite; $cgi=new CGI::Lite; %val = $cgi->parse_form_data; my $seq=$val(’sequence'); my @database=$cgi->get_multiple_values ($val{’database'});
Page 24
VI, March 2005
#!/usr/local/bin/perl ### import modules use CGI::Carp q(fatalsToBrowser); # makes debugging more easy use CGI; ### read arguments ### $cgi=CGI->new(); ### create CGI instance my @interets=$cgi->param('interets'); my $nom=$cgi->param('nom'); my $pass=$cgi->param('motdepasse'); my $genre=$cgi->param('sexe'); my $universite=$cgi->param('universite'); select(STDOUT); ### configure output stream... to possibly send error message ### $| = 1; ### flush buffering to true ### start HTML output print "Content-type: text/html \n\n"; ### required line (HTTP) print "<HTML><HEAD></HEAD><BODY bgcolor='#afeeee'>\n"; if ($genre eq "homme") { $titre = "Monsieur";} else { $titre = "Madame";} print "<h2><p>Bonjour $titre,\n</h2>"; print "<p>Votre nom est <b>$nom</b> et votre mot de passe est <b>$pass</b>\n"; print "<br><p>Vous êtes de l'université dont le code est <b>$universite</b>\n"; print "<p>Vos intérêts sont: <b>@interets</b>!\n"; print "<p><hr width='580'>"; print "</body>"; print "</html>"; exit 0;
Page 25
VI, March 2005
<STYLE type="text/css"> <!-- A:link {color: green} H1 { color: #FFFFFF; font-size: 14px; font-family: Arial; text-align: center; } // --> </STYLE>
<LINK rel="stylesheet" type="text/css" HREF="http://www.expasy.org/ style.css">
Page 26
VI, March 2005
Page 27
VI, March 2005
Page 28
VI, March 2005
Page 29
VI, March 2005
Page 30
VI, March 2005
One can work on a local computer, then use FTP (or cut&paste) to transfer the files to the server. Or using a remote editor (on the server) like emacs or Netscape, one can save the files directly into the final folder. If X-windows doesn ’t work, use pico or vi…
Page 31
VI, March 2005
Login to sib-dea.unil.ch In your home directory
In both subdirs , there is a temporary dir called « wwwtmp » Place your html pages here: /home/username/public_html Place your Perl scripts here: /home/username/cgi-bin Browse your pages at: http://sib-dea.unil.ch/~username/mypage.html Call the scripts from HTML with: /username-cgi-bin/myscript.pl View the temp files with: http://sib-dea.unil.ch/~username/wwwtmp/tempfile.gif
Page 32
VI, March 2005