Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Client Side Scripting
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 11-06-2009, 02:46 AM
  #1
Sawtooth500
Lord (Level 16)
 
Sawtooth500's Avatar
 
Join Date: Nov 2007
Location: Chicago, IL. USA
Posts: 572
iTrader: (0)
Sawtooth500 is on a distinguished road
Undoing CSS with JS

So I have this annoying little customer survey box from bizrate.com that we need on the thank you page of our shopping cart - basically the code for it is just an external JS file we link to. Of course, bizrate, in their infinite wisdom, decided that they would dictate positioning. Using firebug, I found the following HTML code being written by javascript:

<div id="showimage" class="noprint" style="position: absolute; z-index: 9995; display: inline; width: 250px; left: 250px; top: 200px;">

I need to undo ALL the style elements of this div - I want to use javascript to make them blank, as if they were never set in the first place. So how do I "undo" them?
__________________
-Taras Hryniw

http://www.waltonstreetwebdesign.com
Sawtooth500 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-06-2009, 03:55 AM
  #2
coothead
~ bald headed old fart ~
 
coothead's Avatar
 
Join Date: Aug 2003
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 7,917
iTrader: (0)
coothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to behold
Hi there Sawtooth500,

try it like this example...
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english"> 
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">

<title></title>

<style type="text/css">
#showimage {
    font-family:'times new roman',serif;
    font-size:40px;
 }
</style>

<script type="text/javascript">
if(window.addEventListener){
   window.addEventListener('load',removeCSS,false);
 }
else { 
if(window.attachEvent){
   window.attachEvent('onload',removeCSS);
  }
 }

function removeCSS(){
   obj=document.getElementById('showimage')
   obj.style.position='static';
   obj.style.display='block';
   obj.style.width=0;
 }
</script>

</head>
<body>

<div id="showimage" class="noprint" 
style="position: absolute; z-index: 9995; display: inline; width: 250px; left: 250px; top: 200px;">
Sawtooth500
</div>

</body>
</html>
Notice that setting position:static will automatically nullify the z-index:9995, top:200px and left:250px settings.
__________________
coothead is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-07-2009, 02:56 AM
  #3
Sawtooth500
Lord (Level 16)
 
Sawtooth500's Avatar
 
Join Date: Nov 2007
Location: Chicago, IL. USA
Posts: 572
iTrader: (0)
Sawtooth500 is on a distinguished road
Thanks coothead, once again you solved my problem!
__________________
-Taras Hryniw

http://www.waltonstreetwebdesign.com
Sawtooth500 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-07-2009, 07:05 AM
  #4
coothead
~ bald headed old fart ~
 
coothead's Avatar
 
Join Date: Aug 2003
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 7,917
iTrader: (0)
coothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to beholdcoothead is a splendid one to behold
No problem, you're very welcome.
__________________
coothead is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 09:02 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.