Ocenite etot tekst:


---------------------------------------------------------------
 Original etoj stranichki raspolozhen na
 http://wbm.tsu.ru/re/wm_faq.html
 K tomu zhe ona tam regulyarno popolnyaetsya.
 Updated at 13 feb 1993
---------------------------------------------------------------
HOME PAGE

Nekotorye otvety na nekotorye voprosy, kasayushchiesya Web-dizajna. V otvetah privedeny tol'ko sposoby resheniya problemy, a ne zakonchennye programmy i resheniya.
  1. Kak sdelat' animirovannuyu kartinku?
  2. Kak sdelat' kartinku s "prozrachnym" fonom?
  3. Kak rabotaet "sluchajnyj" URL?
  4. A kak sdelat' "sluchajnuyu" kartinku?
  5. Kak otkryt' dopolnitel'noe okno?
  6. Kak sdelat' navigaciyu cherez vypadayushchee menyu?
  7. Kak c pomoshch'yu CGI-programmy pokazat' kartinku?
  8. Inogda trebuetsya udalit' iz fajla vse HTML tegi. Kak eto sdelat'?
  9. Kak zamenit' kartinku, kogda pol'zovatel' "naehal" kursorom na link?
  10. Kak sdelat' chtoby banery, na stranice, menyalis'?

  1. Kak sdelat' animirovannuyu kartinku?
    CHashche vsego (v Web), kak animirovannaya kartinka ispol'zuetsya GIF standarta 89a. CHtoby sdelat' takuyu kartinku neobhodimo imet' sootvetstvuyushchee programmnoe obespechenie i nabor kartinok iz kotoryh budet sobirat'sya animacionnaya kartinka. Programmnoe obespechenie dlya Windows95/NT:
    Microsoft GIF Animator V1.0 (http://www.microsoft.com/imagecomposer/gifanimator/gifanin.htm) freeware
    GIF Construction Set (http://www.mindworkshop.com/alchemy/gifcon.html) shareware
    WWW Gif Animator (http://stud1.tuwien.ac.at/~e8925005/) shareware
    ULead GIF Animator (http://www.ulead.com/) shareware
    Podgotovit' posledovatel'nost' kadrov dlya sozdaniya animirovannoj kartinki mozhno v lyubom animacionnom redaktore.

  2. Kak sdelat' kartinku s "prozrachnym" fonom?
    CHtoby sdelat' kartinku s prozrachnym fonom neobhodimo chtoby vash graficheskij redaktor podderzhival rabotu s formatom GIF89a. Bol'shinstvo sovremennyh graficheskih redaktorov (Adobe Photo Shop 3.5 i vyshe, Corel Photo Paint 7, i t.d.) podderzhivayut etot format. Esli vash graficheskij redaktor ne podderzhivaet etot format, a vy, v silu kakih-libo obstoyatel'stv, ne zhelaete ot nego otkazyvat'sya, mozhno ispol'zovat' nekotorye dopolnitel'nye programmy, takie, kak:
    PhotoImpact Viewer (Ulead Systems, Inc. http://www.ulead.com/) pomimo togo, chto eta programma pozvolyaet prosmatrivat' graficheskie fajly raznoobraznyh formatov, ona pozvolyaet konvertirovat' fajly iz odnogo formata v drugoj, vklyuchaya i GIF89a s zadaniem prozrachnogo fona.

  3. Kak rabotaet "sluchajnyj" URL?
    Proshche vsego, oformit' eto, kak CGI-programmu. Srazu, stoit ogovorit'sya, chto URL ne sovsem sluchajnyj, on sluchajnyj…, no iz vashego spiska. Format spiska prostoj i mozhet popolnyat'sya libo v ruchnuyu, libo drugimi programmami.
    Primer fajl LINKS.LST:
    http://www.tsu.ru/
    http://www.netscape.com/
    http://www.microsoft.com/
    
    CGI-programma na Perl ( rurl.pl ):
    # sluchajnyj URL
    open (FILE, "<LINKS.LST"); # otkryvaem fajl LINKS.LST na chtenie
    @url = (<FILE>);   # prochitali fajl v massiv, odin element massiva - odna stroka iz fajla
    close (FILE);
    srand ( time );
    $index = int ( rand ( $#url + 1 ) );   # poluchili sluchajnoe chislo v intervale ot 0 do $#url + 1
    print "Location: ", $url[$index], "\n\n";
    exit;
    
    Fragment vyzova programmy v HTML-fajle:
    <a href="/cgi-bin/rurl.pl">Sluchajnyj URL</a>
    

  4. A kak sdelat' "sluchajnuyu" kartinku?
    V principe, mozhno ispol'zovat' programmu RURL.PL (sm. "Kak rabotaet "sluchajnyj" URL?"). Otlichiya budut tol'ko v fajle s URL i v sposobe vyzova programmy iz HTML-fajla.
    Primer fajl LINKS.LST:
    http://www.myhost/pics/img01.gif
    http://www.myhost/pics/img02.gif
    http://www.myhost/pics/img03.jpg
    
    Fragment vyzova programmy v HTML-fajle:
    <img src="/cgi-bin/rurl.pl">
    
    Vnimanie! |tot sposob ne ochen' horosho podhodit dlya demonstracii reklamnyh banerov. Hotya, v nekotoryh sluchayah mozhno ispol'zovat' i etu programmu. : )

  5. Kak otkryt' dopolnitel'noe okno?
    Na mnogih Web-sites (dlya navigacii ili otobrazheniya reklamnoj ili drugoj informacii) otkryvayut dopolnitel'noe okno, proshche vsego eto sdelat' na Java Script. Primer:
    <HTML>
    <HEAD>
    <TITLE>My page</TITLE>
    <SCRIPT Language="JavaScript">
    <!--
    var Nwindow = null
    function OpenNW ( url, name, parms ) {
       Nwindow = window.open( url, name, parms );
    }
    // -->
    </SCRIPT>
    </HEAD>
    <BODY>
    ...
    
    Vyzvat' eto bezobrazie mozhno sleduyushchimi sposobami:
    <BODY onload="javascript:OpenNW('some.html', 'window_name', 'width=300,height=100')" ... >
    ili
    <a href="javascript:OpenNW('some.html', 'window_name', 'width=300,height=100')">...</a>
    i t.d.
    
    some.html - eto dlya primera, vmesto etogo dolzhen stoyat' URL na fajl kotoryj vy hotite otobrazit' v otkryvaemom okne.
    window_name - imya okna.

    Pomimo WIDTH i HEIGHT cherez peremennuyu parms mozhno peredat' sleduyushchie parametry otkryvaemogo okna - [toolbar=yes|no], [location=yes|no], [directories=yes|no], [status=yes|no], [menubar=yes|no], [scrollbars=yes|no], [resizable=yes|no]

  6. Kak sdelat' navigaciyu cherez vypadayushchee menyu?
    Dlya etogo mozhno ispol'zovat' CGI - programmu, no v bol'shinstve sluchaev proshche vospol'zovat'sya Java Script. Primer :
    <FORM>
    <SELECT Name="list">
    <OPTION Selected Value="file01.html">Dokument #1</OPTION>
    <OPTION Value="file02.html">Dokument #2</OPTION>
    <OPTION Value="file03.html">Dokument #3</OPTION>
    <OPTION Value="file04.html">Dokument #4</OPTION>
    </SELECT>
    <INPUT Type=button Value="Go" onClick="window.location.href=this.form.list.options[this.form.list.selectedIndex].value">
    </FORM>
    
    Rabotaet eto vot tak:
    V demonstracii ispol'zuyutsya real'nye nazvaniya stranic i real'nye ssylki.

  7. Kak c pomoshch'yu CGI-programmy pokazat' kartinku?
    Inogda neobhodimo vyvodit' kartinku IMENNO CGI-programmoj. Kak eto sdelat'? Predpolozhim u nas est' kartinka (v direktorii cgi-bin) - my_lg01.jpg.
    Fragment CGI-programmy (show_img.pl) na Perl:
    open(FILE, "<my_lg.jpg");
    print "Content-type: image/jpeg\n\n";
    binmode( FILE );
    binmode( STDOUT );
    while (read(FILE, $data, 4096)) {
    	print $data;
    }
    close(FILE);
    
    Vyzov iz HTML-dokumenta budet vyglyadet' tak:
    <img src="/cgi-bin/show_img.pl">
    

  8. Inogda trebuetsya udalit' iz fajla vse HTML tegi. Kak eto sdelat'?
    Mozhno vospol'zovat'sya mnogochislennymi programmami konvertiruyushchimi HTML v razlichnye formaty. Mozhno samomu napisat' malen'kuyu programmku.
    Primer na Perl:
    open(IFILE, "<$ARGV[0]");
    @line = (<IFILE>);
    close(IFILE);
    
    $all_lines = join( "", @line);
    $all_lines =~ s/<([^>]*)>//g;
    
    open(OFILE, ">$ARGV[1]");
    print OFILE $all_lines;
    close(OFILE);
    
    
    Fragment etoj programmki mozhno ispol'zovat' v CGI-programmah dlya udaleniya HTML tegov (naprimer v Guest Book ili Message Board)

  9. Kak zamenit' kartinku, kogda pol'zovatel' "naehal" kursorom na link?
    Poprobujte ispol'zovat' sleduyushchij skript.
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    Version = navigator.appVersion.substring(0,1);
    flag = 0;
    if (Version > 2) {
    	flag = 1;
    }
    
    function switch_img(imgName, imgURL) {
    	if (flag == 1) {
    		document.images[imgName].src = imgURL;
    	}
    }
    // -->
    </SCRIPT>
    
    Vyzyvaetsya eto sleduyushchim obrazom:
    <a href=some.html onMouseOver="switch_img('pic01','box02.gif')" onMouseOut="switch_img('pic01','box01.gif')">
    <img name="pic01" src="box01.gif" width=10 height=10 border=0> Tekst</a>
    
    onMouseOver - vyzyvaetsya, kogda kursor "naehal" na link.
    onMouseOut - vyzyvaetsya, kogda kursor "s®ehal" s linka.
    box01.gif i box02.gif - URL na kartinki.
    P.S. CHestno govorya, ya ne ochen' tshchatel'no testiroval eto, no na Netscape Navigator 3.nn i Netscape Communicator 4.nn eto rabotaet.

  10. Kak sdelat' chtoby banery, na stranice, menyalis'?
    Proshche vsego vospol'zovat'sya takoj priyatnoj vozmozhnost'yu mnogih Web-serverov, kak SSI (Server Side Includes). Server, pered tem kak poslat' HTML-dokument pol'zovatel'yu, razbiraet ego sam i vypolnyaet nekotorye "vstavki" i tol'ko posle etogo otdaet dokument pol'zovatelyu. CHashche vsego, dokumenty s takimi "vstavkami" imeyut tip .shtml, no eto ne obyazatel'no. Dlya primera, ya napisal prosten'kuyu programmu sluchajnogo vybora banera iz spiska.
    #!/usr/local/bin/perl
    # banner.pl
    $banner[0] = '<a href="http://www.some.site/><img src=benner0.gif width=468 height=60 alt="banner0"></a>"';
    $banner[1] = '<a href="http://www.some.site/><img src=benner1.gif width=468 height=60 alt="banner1"></a>"';
    $banner[2] = '<a href="http://www.some.site/><img src=benner2.gif width=468 height=60 alt="banner2"></a>"';
    $banner[3] = '<a href="http://www.some.site/><img src=benner3.gif width=468 height=60 alt="banner3"></a>"';
    $banner[4] = '<a href="http://www.some.site/><img src=benner4.gif width=468 height=60 alt="banner4"></a>"';
    
    srand(time);
    $index = int(rand($#banner+1));
    
      # nekotorye servera trebuyut bolee detal'nogo opisaniya content
      # dlya nih trebuetsya vydavat' v STDOUT eshche odnu stroku:
      # print "Content-type: text/html\n\n";
    
    print $banner[$index];
    exit;
    
    Vyzov v HTML-dokumente:
    Opyat' voznikaet problemma razlichij serverov. Privedu neskol'ko vidov vyzova.
    <!--#include "/cgi-bin/banner.pl"-->
    <!--#include virtual="/cgi-bin/banner.pl"-->
    <!--#exec cgi="/cgi-bin/banner.pl"-->
    
    P.S. Rotaciyu banerov modzhno sdelat' i dlya obychnogo .html, no eto slegka slozhnee.

Prodolzhenie sleduet.
HOME PAGE

Last-modified: Fri, 13 Feb 1998 19:29:58 GMT
Ocenite etot tekst: