¡¾django ѧϰ±Ê¼Ç¡¿12 Êä³ö·ÇHTMLÄÚÈÝ
Django
ÓµÓÐһЩ
±ãÀûµÄÄÚ½¨¹¤¾ß°ïÖúÄãÉú³É³£¼ûµÄ·ÇHTML
ÄÚ
ÈÝ:
RSS/Atom
¾ÛºÏÎļþ
Õ¾µãµØÍ¼ (
Ò»¸öXML
¸ñʽÎļþ,
×î³õÓÉGoogle
¿ª·¢,
ÓÃÓÚ¸øËÑË÷ÒýÇæÌáʾÏßË÷)
»ù´¡:
ÊÓͼºÍMIME
ÀàÐÍ
´ÓÒ»¸öÊÓͼ·µ»ØÒ»¸ö·Ç HTML
ÄÚ
ÈݵĹؼüÊÇÔÚ¹¹ÔìÒ»¸ö HttpResponse
Àà
ʱ,
ÐèÒªÖ¸¶¨ mimetype
²ÎÊý¡£ ͨ
¹ý¸Ä±ä MIME
ÀàÐÍ,
ÎÒÃÇ¿ÉÒÔ֪ͨä¯ÀÀÆ÷½«Òª·µ»ØµÄÊý¾ÝÊÇÁíÒ»ÖÖÀà
ÐÍ¡£
from django.http
import HttpResponse
def my_image(request):
image_data =
open(“/path/to/my/image.png”, “rb”).read()
return
HttpResponse(image_data, mimetype=”image/png”)
Éú³É CSV
Îļþ
import csv
from django.http
import HttpResponse
# Number of unruly
passengers each year 1995 – 2005. In a real application
# this would likely
come from a database or some other back-end data store.
UNRULY_PASSENGERS =
[146,184,235,200,226,251,299,273,281,304,203]
def
unruly_passengers_csv(request):
# Create the
HttpResponse object with the appropriate CSV header.
response =
HttpResponse(mimetype=’text/csv’)
response['Content-Disposition']
= ‘attachment; filename=unruly.csv’
# Create the CSV
writer using the HttpResponse as the “file.”
writer =
csv.writer(response)
writer.writerow(['Year',
'Unruly Airline Passengers'])
for (year, num) in
zip(range(1995, 2006), UNRULY_PASSENGERS):
writer.writerow([year,
num])
return response
Éú³É PDF
Îļþ
°²×° ReportLab
from reportlab.pdfgen
import canvas
from django.http
import HttpResponse
def
hello_pdf(request):
# Create the
HttpResponse object with the appropriate PDF headers.
response =
HttpResponse(mimetype=’application/pdf’)
response['Content-Disposition']
= ‘attachment; filename=hello.pdf’
# Create the PDF
object, using the response object as its “file.”
p =
canvas.Canvas(response)
# Draw things on the
PDF. Here’s where the PDF generation happens.
# S
Ïà¹ØÎĵµ£º
Adobe·¢²¼HTML 5¿ª·¢¹¤¾ß »ùÓÚDreamweaver
Adobe¹«Ë¾ÔÚÉÏÖܾÙÐеÄGoogle I/O¿ª·¢Õß´ó»áÉÏ·¢²¼ÁËÃæÏò¿ª·¢ÕߺÍÉè¼ÆÊ¦µÄHTML 5¹¤¾ß×飬Adobe HTML5 Pack¡£
Adobe HTML5 PackÊǶÔAdobe Dreamweaver CS5µÄÀ©Õ¹£¬ÎªAdobe Creative Suite 5 Óû§ÌṩÁ˸ü¶àµÄ´´ÔìÐÔ¹¦ÄÜ¡£Óû§¿ÉÒÔ¸üÇáËɵش´½¨ºÍÓÅ»¯Æä×÷Æ·¡£
&n ......
ÖÚËùÖÜÖª£¬¶ÔÓÚÁ´½ÓºÍͼƬ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÌí¼Ótitle
Êô
ÐÔÒÔÏÔʾһЩ˵Ã÷ÎÄ×Ö£¬Ò»°ãÇé¿öÏ£¬ÕâЩÎÄ×Ö¶¼ÊÇÏÔʾ³ÉÒ»ÐУ¬ÄÇôÓÐûÓа취ÈÃËüÒÔ¶àÐеķ½Ê½ÏÔÊ¾ÄØ£¿½â¾öµÄ·½·¨ÓÐÁ½ÖÖ£º
1.½«title
Êô
ÐԷֳɼ¸ÐÐÀ´Ð´£¬ÀýÈ磺
<a href=#" title
="˵Ã÷Ò»
˵Ã÷¶þ
˵Ã÷
Èý">Ó¡ÏóÅÉ</a> ......
ÈçºÎʹÓÃHTML Help Workshop
ÓÃHTML Help WorkshopÖÆ×÷chmÎļþºÜ·½±ã£¬ÏÂÃæ¾ÍÒÔ“ÖлªËÑË÷±¦CHINASSB”µÄÈí¼þ˵Ã÷ΪÀý£¬½éÉÜÖÆ×÷µÄ¾ßÌå²½Öè¡£
Ò»¡¢ÖÆ×÷ǰµÄ×¼±¸¹¤×÷
ÓÉÓÚchm°ïÖúÎļþÊÇ»ùÓÚHTMLÎļþÌØÕ÷µÄ£¬ËùÒÔǰÆÚ±àдHTMLÎļþµÄ×¼±¸¹¤×÷ºÜÖØÒª¡£HTML Help WorkshopµÄ½ÇÉ«¾ÍÏñÊÇÒ»¸ö×ܹ ......
Ò»°ãµÄ¿Í»§ÔÚ¸Õ¿ªÊ¼ÍùÍù²»Á˽â×Ô¼ºµ½µ×ÏëҪʲôÑùµÄÈí¼þ£¬Ëæ×ÅÏîÄ¿µÄÒ»²½²½½øÐУ¬ËûÃÇ»á¸ù¾Ýʵ¼ÊÍê³ÉµÄ²¿·ÖÖð½¥ÀíÇåÍ·Ð÷£¬Ìá³ö½øÒ»²½µÄÒªÇó¡£
ÓÐÒ»ÖÖ˵·¨¾ÍÊÇ£¬“ÕæÕýµÄÐèÇóÊÇÔÚµÚÒ»¸ö°æ±¾Íê³ÉµÄʱºò²úÉúµÄ¡£”Óû§ÔÚ¿´µ½ÍêÕûµÄ³ÉÆ·ºó£¬²ÅÊ×´ÎÀí˳ÁË×Ô¼ºµÄ˼·£¬È»ºóÔÚ³ÉÆ·µÄ»ù´¡É϶Թ¦ÄܽøÐÐɾ¼õ¡£
ΪÁËÈÿͻ§ ......
<script language="javascript">
function addItem()
{
var oTable = document.getElementById("whtable");
var oTbody = oTable.tBodies[0];
var v = oTbody.rows.length;
oTbody.insertRow(v);
oTbody.rows[v].id="itemtr ......