情報学部 | 菅沼ホーム | HTML 目次 | 索引 |
<要素名>・・・・</要素名>
文字を<B>太く</B>表示する
文字の背景を<SPAN STYLE="background-color: pink">ピンク</SPAN>にする
01 <!DOCTYPE HTML> 02 <HTML> 03 <HEAD> 04 <TITLE>HTML を理解しよう!</TITLE> 05 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> 06 </HEAD> 07 <BODY> 08 本文の記述(この部分が表示される) 09 </BODY> 10 </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>accesskey</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">accesskey の例</H1> <A HREF="https://www.sist.ac.jp/">静岡理工科大学のホームページ</A> <P> <A HREF="https://informatics.sist.ac.jp/suganuma/" ACCESSKEY="c">菅沼のホームページ</A>: accesskey として c が設定してある </BODY> </HTML>
01 <!DOCTYPE HTML> 02 <HTML> 03 <HEAD> 04 <TITLE>class と id</TITLE> 05 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> 06 <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> 07 <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> 08 <STYLE TYPE="text/css"> 09 .red { color: red } 10 .under { text-decoration: underline } 11 #green { color: lime } 12 </STYLE> 13 </HEAD> 14 <BODY CLASS="white"> 15 <H1 CLASS="center">class と id の例</H1> 16 <DL> 17 <DT>class と id を使用してスタイルを指定した例です. 18 <P> 19 <DD CLASS="red">class を使用</DD> 20 <DD ID="green">id を使用</DD> 21 <DD CLASS="red under">class を使用</DD> 22 </DL> 23 </BODY> 24 </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>contenteditable</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">contenteditable の例</H1> <DIV CLASS="center">(各文章は DIV 要素内の文字列であり,本来編集不可能)</DIV> <P> <DIV CONTENTEDITABLE="true"> CONTENTEDITABLE="true" : この文章は編集可能です. </DIV> <P> <DIV CONTENTEDITABLE="false"> CONTENTEDITABLE="false" : この文章は編集不可能です </DIV> </BODY> </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>dir</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">dir の例</H1> <DIV DIR="ltr">左から右へ</DIV> <DIV DIR="ltr">left to right</DIV> <DIV DIR="rtl">右から左へ</DIV> <DIV DIR="rtl">right to left</DIV> <DIV DIR="auto">自動的に記述</DIV> <DIV DIR="auto">auto</DIV> </BODY> </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>drag & drop</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> <STYLE> #target { width:450px; height:130px; margin:5px; background-color:#EEFFEE; border:1px solid #00cc00; } </STYLE> <SCRIPT TYPE="text/javascript"> // ドラッグ開始(ドロップするデータの ID 名を取得) function drag_start(event) { event.dataTransfer.setData("fig", event.target.id); } // ドラッグ要素がドロップ要素に重なっている間の処理 function dragover(event) { event.preventDefault(); } // ドロップ時の処理 function drop(event) { var id_name = event.dataTransfer.getData("fig"); var drag_elm = document.getElementById(id_name); event.target.appendChild(drag_elm); event.preventDefault(); // drop イベントをキャンセル } </SCRIPT> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">drag & drop の例</H1> <DL> <DT>どの花が好きですか?好きな順に下のエリアに入れて下さい.? <p> <DD><DIV ID="base" onDragover="dragover(event)" onDrop="drop(event)"> <IMG SRC="../ayame.gif" ID="ayame" DRAGGABLE="true" onDragstart="drag_start(event)"> <IMG SRC="../ajisai.gif" WIDTH="115" HEIGHT="121" ID="ajisai" DRAGGABLE="true" onDragstart="drag_start(event)"> <IMG SRC="../sakura.gif" ID="sakura" HEIGHT="121" DRAGGABLE="true" onDragstart="drag_start(event)"> </DIV></DD> <p> <DD><DIV ID="target" DROPZONE="copy" onDragover="dragover(event)" onDrop="drop(event)"></DIV></DD> </DL> </BODY> </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>hidden</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">hidden の例</H1> <DL> <DT>1.<SPAN HIDDEN>表示内容</SPAN>: 表示されない <DT>2.<SPAN>表示内容</SPAN>: 表示される </DL> </BODY> </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>spellcheck</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">spellcheck の例</H1> <DIV CLASS="center">(単語の次に半角スペースを入力した時点でチェックされる)</DIV> <P> <FORM> スペルチェックを行う: <INPUT TYPE="text" SIZE="20" VALUE="summer vacasion" CONTENTEDITABLE="true" SPELLCHECK="true"> <P> スペルチェックを行わない: <INPUT TYPE="text" SIZE="20" VALUE="summer vacasion" CONTENTEDITABLE="true" SPELLCHECK="false"> </FORM> </BODY> </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>style</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">style の例</H1> <DL> <DT>style 属性で<SPAN STYLE="color: red; text-decoration: underline">スタイル</SPAN>を指定した例です. </DL> </BODY> </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>tabindex</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">tabindex の例</H1> <DIV CLASS="center">(TAB キーを押してみて下さい)</DIV> <P> <FORM> <INPUT TYPE="text" VALUE="No.2" TABINDEX="2"> <P> <INPUT TYPE="text" VALUE="No.3" TABINDEX="3"> <P> <INPUT TYPE="text" VALUE="No.1" TABINDEX="1"> </FORM> </BODY> </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>title</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">title の例</H1> <DL> <DT><SPAN TITLE="title 属性の使用例です" STYLE="color: red; text-decoration: underline">ここ</SPAN>にカーソルを持って行って下さい. </DL> </BODY> </HTML>
<!DOCTYPE HTML> <HTML> <HEAD> <!-- タイトル --> <TITLE>イベント処理の方法</TITLE> <!-- スタイルシート --> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> <STYLE> SPAN.cyan { color: cyan } </STYLE> <!-- 文字コード --> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <!-- スマホ --> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <!-- JavaScript --> <SCRIPT TYPE="text/javascript"> // ロード時に onresize に対する処理を追加 window.onresize = function(e) { if (navigator.appName.indexOf("Explorer") >= 0) e = event; alert("event.type : " + e.type); }; // ロード時にイベントリスナを追加 function load() { // onclick 属性に関数を直接設定 document.getElementById("case3").onclick = function(e) { if (navigator.appName.indexOf("Explorer") >= 0) e = event; alert("例3: event.type : " + e.type); }; // 以下に示すいずれの方法でも良い // 関数を外部に記述 // document.getElementById("case3").addEventListener("click", click_e3, false); // 関数を以下のように内部に記述 // document.getElementById("case3").addEventListener("click", function(e) { // alert("例3: event.type : " + e.type); // }, false); } // SPAN 要素内から呼び出し function click_e1(e) { alert("例1: event.type : " + e.type); } // ロード時に追加 function click_e3(e) { alert("例3: event.type : " + e.type); } </SCRIPT> </HEAD> <BODY CLASS="white" onLoad="load()"> <H1 CLASS="center">イベント処理の例</H1> <H3 CLASS="center">(青色の箇所をクリックして下さい.Window サイズを変更してもイベントが発生)</H3> <P> <SPAN CLASS="cyan" onClick="click_e1(event)">イベント処理</SPAN>の例1 onClick 属性に関数名を記述<BR> <P> <SPAN CLASS="cyan" onClick="JavaScript: alert('例2 event.type : ' + event.type)">イベント処理</SPAN>の例2 onClick 属性内に処理を記述<BR> <P> <SPAN ID="case3" CLASS="cyan">イベント処理</SPAN>の例3 ロード時に onClick に対する処理を追加<BR> <P> Window サイズの変更 ロード時に onResize に対する処理を追加 </BODY> </HTML>
[NamedConstructor=Image(), NamedConstructor=Image(unsigned long width), NamedConstructor=Image(unsigned long width, unsigned long height)] interface HTMLImageElement : HTMLElement { attribute DOMString alt; attribute DOMString src; attribute DOMString crossOrigin; attribute DOMString useMap; attribute boolean isMap; attribute unsigned long width; attribute unsigned long height; readonly attribute unsigned long naturalWidth; readonly attribute unsigned long naturalHeight; readonly attribute boolean complete; };
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>DOM インタフェース</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME=viewport CONTENT="width=device-width, initial-scale=1"> <LINK REL="stylesheet" TYPE="text/css" HREF="../../master.css"> <SCRIPT TYPE="text/javascript"> sw = 0; function change() { switch (sw) { case 0: document.getElementById("image").src = "../sakura.gif"; sw = 1; break; case 1: document.getElementById("image").src = "../ajisai.gif"; sw = 2; break; case 2: document.getElementById("image").src = "../ayame.gif"; sw = 0; break; } } </SCRIPT> </HEAD> <BODY CLASS="white"> <H1 CLASS="center">DOM インタフェース</H1> <DIV CLASS="center"><IMG SRC="../ayame.gif" ID="image" onClick="change()"></DIV> </BODY> </HTML>
interface HTMLElement : Element { // metadata attributes attribute DOMString title; attribute DOMString lang; attribute boolean translate; attribute DOMString dir; readonly attribute DOMStringMap dataset; // microdata attribute boolean itemScope; [PutForwards=value] readonly attribute DOMSettableTokenList itemType; attribute DOMString itemId; [PutForwards=value] readonly attribute DOMSettableTokenList itemRef; [PutForwards=value] readonly attribute DOMSettableTokenList itemProp; readonly attribute HTMLPropertiesCollection properties; attribute any itemValue; // acts as DOMString on setting // user interaction attribute boolean hidden; void click(); attribute long tabIndex; void focus(); void blur(); attribute DOMString accessKey; readonly attribute DOMString accessKeyLabel; attribute boolean draggable; [PutForwards=value] readonly attribute DOMSettableTokenList dropzone; attribute DOMString contentEditable; readonly attribute boolean isContentEditable; attribute HTMLMenuElement? contextMenu; attribute boolean spellcheck; void forceSpellCheck(); // command API readonly attribute DOMString? commandType; readonly attribute DOMString? commandLabel; readonly attribute DOMString? commandIcon; readonly attribute boolean? commandHidden; readonly attribute boolean? commandDisabled; readonly attribute boolean? commandChecked; // styling readonly attribute CSSStyleDeclaration style; // event handler IDL attributes attribute EventHandler onabort; attribute EventHandler onblur; attribute EventHandler oncancel; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; attribute EventHandler onclick; attribute EventHandler onclose; attribute EventHandler oncontextmenu; attribute EventHandler oncuechange; attribute EventHandler ondblclick; attribute EventHandler ondrag; attribute EventHandler ondragend; attribute EventHandler ondragenter; attribute EventHandler ondragleave; attribute EventHandler ondragover; attribute EventHandler ondragstart; attribute EventHandler ondrop; attribute EventHandler ondurationchange; attribute EventHandler onemptied; attribute EventHandler onended; attribute OnErrorEventHandler onerror; attribute EventHandler onfocus; attribute EventHandler oninput; attribute EventHandler oninvalid; attribute EventHandler onkeydown; attribute EventHandler onkeypress; attribute EventHandler onkeyup; attribute EventHandler onload; attribute EventHandler onloadeddata; attribute EventHandler onloadedmetadata; attribute EventHandler onloadstart; attribute EventHandler onmousedown; attribute EventHandler onmousemove; attribute EventHandler onmouseout; attribute EventHandler onmouseover; attribute EventHandler onmouseup; attribute EventHandler onmousewheel; attribute EventHandler onpause; attribute EventHandler onplay; attribute EventHandler onplaying; attribute EventHandler onprogress; attribute EventHandler onratechange; attribute EventHandler onreset; attribute EventHandler onscroll; attribute EventHandler onseeked; attribute EventHandler onseeking; attribute EventHandler onselect; attribute EventHandler onshow; attribute EventHandler onstalled; attribute EventHandler onsubmit; attribute EventHandler onsuspend; attribute EventHandler ontimeupdate; attribute EventHandler onvolumechange; attribute EventHandler onwaiting; }; interface HTMLUnknownElement : HTMLElement { };
<!-- これはコメントである -->
「&」:「&」記号 「"」,「"」: 二重引用符 「'」: 単引用符 「<」: < 「>」: > 「å」: 上に丸が付いたa 「水」(十六進数値): 水
情報学部 | 菅沼ホーム | HTML 目次 | 索引 |