Home > Web Front-end > HTML Tutorial > Remove the expression Expression_html/css_WEB-ITnose in CSS

Remove the expression Expression_html/css_WEB-ITnose in CSS

WBOY
Release: 2016-06-24 11:55:54
Original
1120 people have browsed it

In IE, CSS can embed js expressions and can be defined in CSS classes. However, if the CSS class containing the expression is removed from the DOM object, the style expression will not be invalid. .

After research, I found the answer. You need to use js to call the removeExpression() method of the style object to remove it.

The following is a description of the method:

Syntax

bSuccess = object<strong>.removeExpression(</strong>sPropertyName<strong>)</strong>
Copy after login

Parameters

table> Returns one of the following possible values: Switch between actual size and zoomed size with one button.

sPropertyName Required.
sPropertyName Required. String that specifies the name of the property from which to remove an expression.
String

that specifies the name of the property from which to remove an expression.

true The expression was successfully removed.
false The expression was not removed.
CSS class, function: limit the maximum width of the image, and shrink it proportionally beyond the specified width.

Css code

.wrap {

border:none;
    max-width:730px ;
  1. height:auto;
  2. width:expression(this.width>730?"730px":true);/*ie6 patch*/
  3. }
  4. Image

Html code

  1. Toggle Button

Html code

[original size]

  1. js code (requires jQuery)

Java code

function showOrigin(){

$('#chart_img').toggleClass("chart");
  1. if($('#chart_img'). attr("class")){
  2. $('#imgctr').text("[original size]");
  3. }else{
  4. $(' #imgctr').text("[zoom size]");
  5. $('#chart_img')[0].style.removeExpression('width'); /*ie6 patch*/
  6.  
  7. }
  8. This example can only reflect the function of removeExpression() in IE6, ie7 The above is not required.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template