[Javascript] GetElementByElement?
Chris Tifer
christ at saeweb.com
Wed Mar 3 13:25:52 CST 2004
GetElementByElement?If I get you right, you should just need to give this DIV an ID and call something like:
setStyle("IDName", "display", "none")
// Where IDName is the ID of your DIV
Now if you want to use this method to apply multiple styles to a single element, it looks like you'll just need to make multiple calls.
Chris Tifer
----- Original Message -----
From: Simeon Willbanks
To: javascript at latech.edu
Sent: Wednesday, March 03, 2004 1:58 PM
Subject: [Javascript] GetElementByElement?
Hello All,
I grabbed a bit of code from a dhtml kitchen tutorial. I am trying to modify it to fit my needs. Below is the original code
function setStyle(obj,style,value){
getRef(obj).style[style]= value;
}
function getRef(obj){
return (typeof obj == "string") ?
document.getElementById(obj) : obj;
}
You can then use an onclick event to set a style by id, and it works beautifully.
<p class="link" onclick="setStyle('fixed','visibility','hidden')">Close The Ad</p>
What I need to do is change and element property along with an id property. In other words, set a div to display:none; and change the an element like body: padding-bottom: 0;
I don't know if a function exists like getElement? Maybe than I could write a function to recognize the body element css properties in order to switch the properties? Has anyone tired to do this before? Any help would be appreciated.
Thanks,
Simeon
------------------------------------------------------------------------------
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20040303/e1a6f308/attachment.htm>
More information about the Javascript
mailing list