-1
A
答えて
1
このようなコマンドはJavaScriptにはありませんが、独自の小さなフォント選択ツールを作成することはできます。ここで は一例です:
function updateh1family() {
var selector = document.getElementById('selecth1FontFamily');
var family = selector.options[selector.selectedIndex].value;
var h1 = document.getElementById('text')
h1.style.fontFamily = family;
}
function updateSize() {
document.getElementById('text').style.fontSize = document.getElementById('size').value + "px";
}
function updateColor() {
document.getElementById('text').style.color = document.getElementById('color').value;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<font id="text" style="font-size:30px;">Some text</font><br>
<select id="selecth1FontFamily" name="selectFontFamily" onchange="updateh1family();">
<option> Serif </option>
<option> Arial </option>
<option> Sans-Serif </option>
<option> Tahoma </option>
<option> Verdana </option>
<option> Lucida Sans Unicode </option>
</select>
<input type="number" id="size" min="0" max="70" value="30" onchange="updateSize()" />
<input type="color" onchange="updateColor()" id="color" />
</body>
</html>
あなたも、それはjQueryを使って、ダイアログのように見えるようにできます:あなたは `WYSIWYGを使用することができます https://jqueryui.com/dialog/
function updateh1family() {
var selector = document.getElementById('selecth1FontFamily');
var family = selector.options[selector.selectedIndex].value;
var h1 = document.getElementById('text')
h1.style.fontFamily = family;
}
function updateSize() {
document.getElementById('text').style.fontSize = document.getElementById('size').value + "px";
}
function updateColor() {
document.getElementById('text').style.color = document.getElementById('color').value;
}
function showDialog() {
$("#dialog").dialog();
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<button onclick="showDialog()">open dialog</button>
<div id="dialog" style="display:none;">
<font id="text" style="font-size:30px;">Some text</font><br>
<select id="selecth1FontFamily" name="selectFontFamily" onchange="updateh1family();">
<option> Serif </option>
<option> Arial </option>
<option> Sans-Serif </option>
<option> Tahoma </option>
<option> Verdana </option>
<option> Lucida Sans Unicode </option>
</select>
<input type="number" id="size" min="0" max="70" value="30" onchange="updateSize()" />
<input type="color" onchange="updateColor()" id="color" />
</div>
</body>
</html>
0
どのプラットフォームを使用していますか?あなたはHTAを試しましたか? 事前HTMLではこれはできません.HTAとactiveXを見てください。
関連する問題
- 1. Django html onclick別のhtmlページを開く
- 2. 印刷用のhtmlページを開く
- 3. 別のページをHTMLで開く
- 4. odoo 9モジュール内のhtmlページを開く
- 5. htmlページ用に開く(Safariで)
- 6. HTMLページを開かずにHTMLページのjavascriptを実行
- 7. デフォルトのブラウザでインストールCDのhtmlページを開く
- 8. HTMLページ上のリンクをiPad上のPDFの特定のページに開く
- 9. HTMLページから電話機のカメラを開く方法は?
- 10. 電子:クリックネイティブメニュー項目のBrowserWindowでhtmlページを開く
- 11. iPhoneで画像を開くYouTubeのビデオSafari HTMLページ
- 12. 私が直接開く簡単なHTMLページを持っているAjaxのHTML
- 13. fancyboxを使ってポップアップHTMLページを開く
- 14. これを開く前にHTMLページに影響を及ぼす
- 15. Jsoupがhtmlページを開くことができません
- 16. 素材デザインHTML5とJQuery PopUpでページを開く(.html)
- 17. htmlページからネットワーク共有にある「ファイルを開く」?
- 18. CD/DVDにhtmlページを自動的に開く方法
- 19. ブートストラップモーダルとしてJavaスクリプトからhtmlページを開くには?
- 20. ブラウザが保存されたhtmlページを開く方法
- 21. 別のページにページを開くbootstrap jQuery
- 22. htmlページのハイパーリンクをくりぬく
- 23. AMP-HTMLページAMPページの多くに
- 24. リンクを開くonclick html
- 25. C#でHTMLドキュメントを開く
- 26. パラメータでhtmlを開く
- 27. ファイルをHtmlボタンで開く
- 28. サーブレットでhtmlファイルを開く
- 29. EclipseでHTMLファイルを開く
- 30. htmlファイルを開くには?
'あなたはフォントダイアログを開くことができません。 htmlページ。 – Dark