zoukankan      html  css  js  c++  java
  • css中的Expression

    css中的Expression

    问题说明: 用过css样式我们就知道, 可以定义一批对象的class属性来指定同一个样式来统一界面. 但如何统一同类型的对象的事件? 比如:界面有无数个 <img src="**.jpg"> 如何实现鼠标经过此图片, 图片的src变成是**_over.jpg?
     
     
    解决方法: 使用css的expression方法,
    具体实现要看看.css的写法:
     
    /*替换图片CSS*/
    #imgScript {   /*这里使用对象ID来通配样式, 也可以定义一个css函数*/
     star:expression(
        onmouseover = function()
        {
            /*替换图片*/
            if(this.hover != null){
              this.name = this.src;
              this.src = this.src.replace('.jpg', '_over.jpg');
              this.HasChg = 1;
           }
       },
       onmouseout = function()
      { 
           /*还原本来的图片*/
         if(this.HasChg != null){
            this.src = this.name;
            this.HasChg = null;
        }
     }
    )

    }/*end imgScript*/
     
    应用样式的img:
    <img src="a.jpg">
     
    请将鼠标放在a.jpg上看看效果

    2.去掉用IE6.0浏览图片,当鼠标放到图片上时出现快捷工具(打印、邮寄、另存等)

    方法一:
    <META HTTP-EQUIV="imagetoolbar" CONTENT="no">
    方法二:
    <img galleryimg="no">
    定义CSS:
    <style>
    img {nobar:expression(this.galleryImg='no')}
    </style>

    3.去掉热点地图上的区域线框与超链接的线框

    使用CSS定义
    <style>
    a {blr:expression(this.onFocus=this.blur())}
    area {blr:expression(this.onFocus=this.blur())}
    </style>
    或者
    <a href="http://endchanllege.spaces.com" onFocus=this.blur()><img src="images/logo.gif" order=0></a>

    点个广告:
  • 相关阅读:
    Handlebars模板引擎简单使用
    SpringMVC学习笔记001-服务器端获取JSON字符串并解析
    EL表达式的使用
    SpringMVC学习笔记001
    ExtJS学习之路碎碎念
    Microsoft Word 使用技巧总结
    驼峰命名法
    视图生命周期
    git命令
    git的使用1[转]
  • 原文地址:https://www.cnblogs.com/hanxianlong/p/906223.html
Copyright © 2011-2022 走看看