<html>
<body>

<script type="text/javascript">

var txt="Hello World!"

document.write("<p>Big: " + txt.big() + "</p>")//大字体
document.write("<p>Small: " + txt.small() + "</p>")//小字体

document.write("<p>Bold: " + txt.bold() + "</p>")//加粗
document.write("<p>Italic: " + txt.italics() + "</p>")//倾斜

document.write("<p>Blink: " + txt.blink() + " (does not work in IE)</p>")//闪烁
document.write("<p>Fixed: " + txt.fixed() + "</p>")//固定大小
document.write("<p>Strike: " + txt.strike() + "</p>")//划掉

document.write("<p>Fontcolor: " + txt.fontcolor("Red") + "</p>")//字体颜色
document.write("<p>Fontsize: " + txt.fontsize(16) + "</p>")//字体大小

document.write("<p>Lowercase: " + txt.toLowerCase() + "</p>")//小写
document.write("<p>Uppercase: " + txt.toUpperCase() + "</p>")//大写

document.write("<p>Subscript: " + txt.sub() + "</p>")//偏下
document.write("<p>Superscript: " + txt.sup() + "</p>")//偏上

document.write("<p>Link: " + txt.link("http://www.baidu.com") + "</p>")//链接
</script>

</body>
</html>

Big: Hello World!

Small: Hello World!

Bold: Hello World!

Italic: Hello World!

Blink: Hello World! (does not work in IE)(闪烁)

Fixed: Hello World!

Strike: Hello World!

Fontcolor: Hello World!

Fontsize: Hello World!

Lowercase: hello world!

Uppercase: HELLO WORLD!

Subscript: Hello World!

Superscript: Hello World!

Link: Hello World!

天再高,踮起脚尖就能更接近阳光

js 为字符串添加样式的更多相关文章

  1. js实现元素添加样式

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. JavaScript为字符串添加样式

    <script type="text/javascript"> var txt="Hello World!" document.write(&quo ...

  3. js给元素添加样式[addClass][hasClass]

    function addClass(el, className) { if (hasClass(el, className)) { return } let newClass = el.classNa ...

  4. React使用Styled-Componets来添加样式

    React使用Styled-Componets来添加样式 Styled-Comonents是用JS中ES6 语法的方式来管理CSS样式的一个组件,解决了在import CSS文件时样式重复 安装 项目 ...

  5. 原生js动态添加style,添加样式

    原生js动态添加style,添加样式 第一种 var style="[assign-url='"+str+"']{display:initial}"; var ...

  6. Vue.js随笔二(新建路由+component+添加样式+变量的显示)

    创建一个页面: 1.首先让我们看一下整个vue.js的目录,如下图所示: 2.现在让我们创建一个页面吧: 2-1首先你需要新建路由(就和建立一个如何找到项目文件的目录一个意思):进入src/route ...

  7. 改变某个对象的CSS样式时,不要使用JS直接添加样式,

    重绘: 使用js改变网页的背景颜色 浏览器会把整个网页的颜色重新在画一遍,导致性能降低 回流: 只要改变某个DOM对象的宽或者高,浏览器就会重新再计算网页结构,重新生成一次,导致性能严重降低. CSS ...

  8. 原生js移除或添加样式

    样式效果如下,点击商品详情 添加样式active 代码 <!doctype html> <html lang="en"> <head> < ...

  9. js 为url字符串添加、修改参数

    //为url字符串添加.修改参数 String.prototype.EditUrlParam = function (paramName, replaceWith) { var url = this; ...

随机推荐

  1. Python开发【杂货铺】:模块logging

    logging模块 很多程序都有记录日志的需求,并且日志中包含的信息即有正常的程序访问日志,还可能有错误.警告等信息输出,python的logging模块提供了标准的日志接口,你可以通过它存储各种格式 ...

  2. sql之连表查询--效率 通过分析各种连接查询的实现原理来了解

    1. 左连接 2.右连接 3.内连接 4.Cross join 笛卡尔乘积

  3. 我的AngularJS 学习之旅

    我的AngularJS 学习之旅 基础篇 1.Angular的 起源 2.比较Web 页面实现的几种方式 3.一些基本术语 4.Angular与其他框架的兼容性 5.总结 6.综合实例   很早之前就 ...

  4. Fatal error: Call to undefined function curl_init()问题

    最近分别在win7和Win8.win10 上分别安装php 高版本!都遇到了这个问题! 一.win7系统, apache2.2/apache2.4, php5.2升级到5.4. 这个比较容易: 1. ...

  5. 前端forEach在Array、map、set中的使用

    数组: var s = ['a','b','c']; s.forEach(function(ele,index,array){ console.log(ele); }); Map: var map = ...

  6. 关于firewalld防火墙的使用

    要想使用该防火墙,应该需要安装 networkmanager 并启动其服务.因为之前使用的是 netctl 提供的wifi-menu 来连接无线网络,导致安装networkmanager之后启动 Ne ...

  7. python 学习(二)--关于类

    1.没有权限控制,在类方法或变量前加 "__" 两下划线,则变为"私有"变量(实际通过_<类名>__<变量或方法名> 可以访问) 2.类 ...

  8. gerrit session expired 怎么解决,搜索未果

    gerrit session expired,怎么解决,搜索未果

  9. Swift2.3 --> Swift3.0 的变化

    Swift3.0语法变化 首先和大家分享一下学习新语法的技巧: 用Xcode8打开自己的Swift2.3的项目,选择Edit->Convert->To Current Swift Synt ...

  10. angularJS——模块

    一.在讲angularjs的模块之前,我们先介绍一下angular的一些知识点: AngularJS是纯客户端技术,完全用Javascript编写的.它使用的是网页开发的常规技术(HTML,CSS,J ...