<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. java中的注解(Annotation)

    转载:https://segmentfault.com/a/1190000007623013 简介 注解,java中提供了一种原程序中的元素关联任何信息.任何元素的途径的途径和方法. 注解是那些插入到 ...

  2. cocos2d学习记录

    视频 - http://www.manew.com/forum-105-3.html一个论坛帖 - http://www.zhihu.com/question/21114802官网 - http:// ...

  3. python 3.5 关于sys问题总结

    想把自己写的模组直接调用的时候,使用这个sys.path.append(): 但是总是报错(图1): 解决方案,去掉前面的from public; 解决思路: 1.sys.path.append(&q ...

  4. Design Tic-Tac Toe

    Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the fol ...

  5. 【C# 小窍门】WeakEventManager 无法识别!ErrorCS0246The type or namespace name 'WeakEventManager' could not be found

    WeakEventManager 想用一下这个,在学习C# 事件的时候,结果添加了Using System.Windows, WeakEventManager却一直是红色的,无法识别,报这个错哦~ 好 ...

  6. zzuli-小火山的跳子游戏

    Description   小火山和火山火山在一块玩跳子游戏.规则如下:   1:跳子的起始位置为0,棋盘大小从1到N   2:每次跳子跳k步. 例如当前位置为i, 那么下一步为i + k   3:跳 ...

  7. php 设计模式

    一.工厂模式 1.创建接口类,规范方法,要实现这个接口的类必须实现这个接口的所有方法,接口的方法默认是抽象的,所以不再方法前面加 abstract interface people{ public f ...

  8. FluentData-新型轻量级ORM 利用T4模板 批量生成多文件 实体和业务逻辑 代码

    FluentData,它是一个轻量级框架,关注性能和易用性. 下载地址:FlunenData.Model 利用T4模板,[MultipleOutputHelper.ttinclude]批量生成多文件 ...

  9. final发布评论

    在刚刚过去的final发布会上,各小组都展示了自己团队两个月来的团队成果.以下是我对各小组的发布 过程和产品展示的评论. 1.金州勇士团队 金州勇士团队的作品是在线考试系统.从产品的角度来说,相比于b ...

  10. ios异常错误

    1,mach_msg_trap处异常 http://www.jianshu.com/p/2b3f58c61d7d 在lldb下敲入bt (lldb) bt