【高级网络程序设计】Week2-3 HTML

一、The Basics

1. HTML&HTML file

HTMLMarkup language
Hyper Text Markup Language
HTML fileText file with markup tags
.htm/.html extension

Create an html file

Open an editor

Type: <html><head><titile><body>

Save it as .html

Open it using a browser

2. HTML tags & HTML elements

HTML tagsmark-up HTML elements
<element content>
HTML elementsdefined using HTML tags
HTML documents text files made up of HTML elements
Basic HTML tagsParagraphs

<p></p>

(browsers automatically add an empty line before and after a paragraph)

Headings<h></h>
Line breaks

<br/>

(to enter line breaks, not to seperate paragraphs)

Horizontal rule<hr>
Comments<!-- -->
HTML document<html>
document's body<body>
the document's area for header/control infomation<head>
document's title<title>

二、Build a Web Page

1. HTML Attributes & HTML Text Formatting

HTML Attributesprovide additional information to an HTML element
case insensitive
HTML Text Formatting<b></b> bold
<strong></strong>strong
<bid></big>big
<em></em>emphasized
<i></i>italic
<small></small>small
<sub></sub>subscripted
<sup></sup>superscripted
<ins></ins>inserted
<del></del>deleted

2. Character Entities

non-breaking space&nbsp
less than&lt
greater than&gt
ampersand&amp
quotation mark&quot
pound&pound
yen&yen
euro&euro
section&sect
copyright&copy
registered trademark&reg
multiplication&times
division&divide

3. HTML Links

link to another document on the Web

<a href="linkpage.html">This text</a>

<a  href="http://www.qmul.ac.uk/">This text</a>

an image as a link

<a href="linkpage.html">

<img border="0" src="image.jpg" width ="65" height="38"></a>

Target: where to open the linked document

_blank: open in a new window or tab

<a href="http://www.qmul.ac.uk/" target="_blank"></a>

_self: open in the same frame as it was clicked

_parent: open in the parent frame

_top: open in the full body of the window

framename: open in a named frame

name and section

<a name="top">top of the page</a>

<a href="section.html"#top>Jump to the top</a>

4. HTML Tables/Lists/Images & Colors

HTML Tablesa table<table>
a table header<th>
table row<tr>
table cell<td>
table caption<caption>
table head<thead>
table body<tbody>
table footer<tfoot>
其他

Align the text: <td align = "left/right/center"></td>

Background colour: <table border = "1" bgcolor="red">

Background image: <table border = "1" background = "bg.jpg">

HTML

Lists

Unordered list

<ul>        <li></li>        </ul>

Ordered list<ol>        <li></li>        </ol>
Type of ordered list<ol type = "A/a/Ⅰ/i">

HTML

Images & Colors

Insert an image <img><img src = "image.gif" width = "144" height = "50">
alt attribute

define an "alternate text" for an image

<img src = "me.jpg" alt = "This is me">

Background image<body background="background.jpg">
Background color<body bgcolor="#d0d0d0">
Text colour<body bgcolor="#d0d0d0" text="yellow">

三、Handling User Input

1. HTML Forms and Input

HTML Formsselect different kinds of user input
an area that contain form elements that allow user to enter information
<form>        <input></input>        </form>
Inputtype is specified with type attribute

2. Text Fields/Password Fields/Radio Buttons/Check Boxes/Simple dropdown box/Fieldset/Textarea/Button

Text Fields
<form action="">
<input type = "text" name="user">
</form>
name: the identifier that is sent to the server when you submit the form
Password Fields
<form action="">
<input type="password" name="password">
</form>
displays asterisks or bullet points instead of characters
Radio Buttons
<form>
<input type="radio" name="sex" value="male">Male
<input type="radio" name="sex" value="female">Female
</form>
select one of the choices
Check Boxes
<form>
<input type = "checkbox" name="vehicle" value="bike">
<input type = "checkbox" name="vehicle" value="car">
</form>
select one or more options
Defining <label> for button

Each button should have a label

<label>: defines a label for an <input> element

              allow a user to click on the label as well as the button

The for attribute of the <label> tag =  the id attribute of the related element

<form action="demo_form.asp">
    <label for = "male">Male</label>

    <input type = "radio" name="sex" id ="male" value="male">Male

    <label for = "female">Female</label>

    <input type = "radio" name="sex" id ="female" value="female">Female

    <input type = "submit" value="Submit">
</form>

Action attribute

define the name of the file to send the content to

the file defined in the action usually does something with the received input 

Submit attribute

the content of the form is sent to another file

Image act as a submit buttonThe image type is by default a form submitting button
Simple dropdown box

<form action="">

        <select name="cars">
                <option value="volvo">Volvo</option>
                <option value="saab">Saab</option>
                <option value="audi">Audi</option>
        </select>
</form>

Fieldset

<fieldset>
    <legend>
       Health information:
    </legend>
    <form action="">
        Height<input type="text" size="3">
        Weight<input type="text" size="3">
    </form>
</fieldset>

Textarea
<textarea rows="10" col="30">    The cat was in the garden
</textarea>
 Button
<form action=""><input type="button" value="Hello world!">
</form>
Difference between button and submit

<input type="button">: will not submit a form on their own——they don't do anying by default.

<input type="submit">: will submit the form they are in when the user clicks on them

Difference between id and name

The name attribute: what is sent when the form is submitted.

The id attribute: uniquely identifies any element on the page.

When the form is submitted, only the selected option is sent.

3. Form Tags

<form>a form for user input
<input>an input field
<textarea>a text-area
<label>a label to a control
<fieldset>a fieldset
<legend>a caption for a fieldset
<select>a selectable list
<optgroup>an option group
<option>an option in the drop-down box
<button>a push button

思维导图

Exercise

1. What is the difference between the three text boxes?

The values of them are different. 

2. What happens if you change this tag <body> to <body bgcolor=ccffcc>?

3. What happens if you add this tag after the body tag: <front face=arial>?

4. What happens if you delete a <br> tag?

5. What happens if you add this before the first text box:<h2>Please add information</h2>

6. What happens if you do NOT include the closing tag i.e. </h2>?

1. Does the page display what is written in the value attribute (e.g. pz) or what is written after the tag (e.g. pizza)?

No.

2. Can a user select more than one food type?

No. Checkbox can.

3. Change the name of the last radio button (i.e. the one for the salad), from name=food to name=morefood. Can the user now select more than one food type (e.g. salad and pasta)?

No.

1. Does the list show the word bungalow or bung?

bung.

2. In Internet Explorer (IE), add a space followed by the word selected after bungalow. Save the file and refresh the browser. What has changed? 

bung is selected by default.

1. Write the difference between the three textAreas? 1) 2) 3)

The name and default content

2. How would you correct the third textArea?

3. There is no value attribute – what is the value of a textArea?

The text content of it.

Lab2——html

Questions

1. What is HTML? How does it relate to HTTP?

· HTML is a mark-up language, which is used to build a web page and handle user input.

· HTTP is the application protocol which is used to request and response on the browser and client. 

· HTML build the web page, and HTTP send and receive the web page.

2. In HTML, you can have input of type submit, together with an associated button (like the Submit button in Error! Reference source not found.). What is supposed to happen when you click that button?

Button will not submit a form on their own, they don't do anything by default. However, submit buttons will submit the form they are in when the user clicks on them

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/156346.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C++二分查找算法:132 模式解法三枚举1

本文涉及的基础知识点 二分查找算法合集 本题不同解法 包括题目及代码C二分查找算法&#xff1a;132 模式解法一枚举3C二分查找算法&#xff1a;132 模式解法二枚举2代码最简洁C二分查找算法&#xff1a;132 模式解法三枚举1性能最佳C单调向量算法&#xff1a;132 模式解法三…

关于 Git 你了解多少?

1. 什么是Git? Git 是一个版本控制系统&#xff0c;由林纳斯托瓦兹创建。它旨在管理项目代码的更改&#xff0c;以便团队成员可以协作开发和维护代码库。Git 可以让用户跟踪代码的更改、回滚错误的更改、合并代码等。Git 还具有分支和标签的功能&#xff0c;使得团队成员可以在…

人工智能时代:深入了解与学以致用的智能科技

目录 前言人工智能的领域1. 医疗健康2. 交通与智能驾驶3. 教育领域4. 金融与人工智能5. 制造业与自动化 人工智能的应用1. 智能手机与语音助手2. 智能家居系统3. 自动驾驶汽车4. 医疗诊断与治疗5. 金融风控与预测分析 对人工智能的看法1. 科技的利弊2. 伦理和隐私问题3. 人工智…

中国毫米波雷达产业分析1——毫米波雷达行业概述

一、毫米波雷达简介 &#xff08;一&#xff09;产品定义 雷达是英文Radar的音译&#xff0c;源于Radio Detection and Ranging的缩写&#xff0c;原意是“无线电探测和测距”&#xff0c;即用无线电方法发现目标并测定它们在空间的位置。毫米波雷达是指一种工作在毫米波频段的…

过了那么多1024节才知道……

各位大佬好啊&#xff0c;相信程序员们都知道1024节&#xff0c;那么咱程序员一般会采取什么样的方式来度过程序员节呢&#xff1f;那我们就继续往下看哦&#xff0c;小编包您满意&#xff01; 先来了解一下历史吧&#xff01;1024节的起源可以追溯到2009年&#xff0c;当时俄…

如何让bug远离你?

想让bug远离你&#xff0c;当然是靠佛祖保佑~ /** *************************************************************************** ******************** ********************* ******************** COPYRIGHT INFORMATION *…

股票统计信息(七)

7-统计信息 文章目录 7-统计信息一. 股票周级别统计信息二. 查询可支持的所有的股票资金类型三. 股票图形统计信息四. 查询当前用户自选表里面最近十天的交易信息五. 查看天/星期范围统计的历史记录六. 查看最近多少天某个属性的涨跌幅度值 一. 股票周级别统计信息 接口描述: …

Redis:抢单预热

前言 在当今的互联网时代&#xff0c;抢单活动已经成为了电商平台、外卖平台等各种电子商务平台中常见的营销手段。通过抢单活动&#xff0c;商家可以吸引大量用户参与&#xff0c;从而提高销量和知名度。然而&#xff0c;抢单活动所带来的高并发请求往往会给系统带来巨大的压…

linux:查看文件前100行和后100行

查看文件中的前100行 head -n 100 文件名查看文件中的后100行 tail -n 100 文件名

Fiddler抓包看这篇就够了:fiddler设置弱网测试

弱网测试 概念&#xff1a;弱网看字面意思就是网络比较弱&#xff0c;我们通称为信号差&#xff0c;网速慢。 意义&#xff1a;模拟在地铁、隧道、电梯和车库等场景下使用APP &#xff0c;网络会出现延时、中断和超时等情况。 自动化测试相关教程推荐&#xff1a; 2023最新自…

【LeetCode刷题-数组】--18.四数之和

18.四数之和 方法&#xff1a;排序双指针 先对数组进行排序&#xff0c;使用两重循环分别枚举前两个数&#xff0c;然后在两重循环枚举到的数之后使用双指针枚举剩下的两个数 class Solution {public List<List<Integer>> fourSum(int[] nums, int target) {List…

python实战—核心基础3(RGB模式颜色转换器) lv1

目录 一、核心代码解释 二、代码 三、运行截图 一、核心代码解释 1、hex() 函数 参数说明&#xff1a; x -- 10进制整数 返回值&#xff1a; 返回16进制数&#xff0c;以字符串形式表示。 实例&#xff1a; 以下实例展示了 hex 的使用方法&#xff1a; >>>h…

第一次性能测试懵逼了

最近&#xff0c;公司领导让我做下性能方面的竞品对比&#xff0c;作为一个性能测试小白的我&#xff0c;突然接到这样的任务&#xff0c;下意识发出大大的疑问。 整理好心情&#xff0c;内心想着“领导一定是为了考验我&#xff0c;才给我这个任务的”&#xff0c;开始了这一次…

Mysql之聚合函数

Mysql之聚合函数 什么是聚合函数常见的聚合函数GROUP BYWITH ROLLUPHAVINGHAVING与WHERE的对比 总结SQL底层原理 什么是聚合函数 对一组数据进行汇总的函数&#xff0c;但是还是返回一个结果 聚合函数也叫聚集&#xff0c;分组函数 常见的聚合函数 1.AVG(): 求平均值 2.SUM() :…

每日一练 | 华为认证真题练习Day134

1、开启标准STP协议的交换机可能存在哪些端口状态&#xff1f;&#xff08;多选&#xff09; A. Discarding B. Listening C. Disabled D. Forwarding 2、下列路由协议中优先级最高的是&#xff1f; A. Direct B. RIP C. OSPF D. Static 3、参考如图所示的输出结果&…

【双指针】盛水最多的容器

盛水最多的容器 文章目录 盛水最多的容器题目描述算法原理思路一思路二 代码实现Java代码实现C代码实现 题目描述 给定一个长度为 n 的整数数组 height 。有 n 条垂线&#xff0c;第 i 条线的两个端点是 (i, 0) 和 (i, height[i]) 。 找出其中的两条线&#xff0c;使得它们与…

Python+Qt虹膜检测识别

程序示例精选 PythonQt虹膜检测识别 如需安装运行环境或远程调试&#xff0c;见文章底部个人QQ名片&#xff0c;由专业技术人员远程协助&#xff01; 前言 这篇博客针对《PythonQt虹膜检测识别》编写代码&#xff0c;代码整洁&#xff0c;规则&#xff0c;易读。 学习与应用推…

C 语言获取文件绝对路径

示例代码 1&#xff0c;不包含根目录绝对路径&#xff1a; #include <stdlib.h> #include <stdio.h>int main(void) {char *fileName "/Dev/test.txt";char *abs_path _fullpath(NULL, fileName, 0);printf("The absolute path is: %s\n", a…

【藏经阁一起读】(77)__《Apache Dubbo3 云原生升级与企业最佳实践》

【藏经阁一起读】&#xff08;77&#xff09; __《Apache Dubbo3 云原生升级与企业最佳实践》 目录 一、Dubbo是什么 二、Dubbo具体提供了哪些核心能力&#xff1f; 三、构建企业级Dubbo微服务 &#xff08;一&#xff09;、创建项目模板 &#xff08;二&#xff09;、将…

【Qt一坑】qt编译出现“常量中有换行符”

在qt编译过程中出现“常量中有换行符”&#xff0c;原因有以下几点&#xff08;qt版本5.14.2&#xff09;&#xff1a; 1.中文编码格式问题&#xff0c;将UTF-8编码格式改成 UTF-8 BOM。 或者使用QtCreator 进行如下设置&#xff08;找到Qt的左边列表里的项目&#xff0c;下的…