Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call style sheet attributes from javascript function?

Status
Not open for further replies.

strogonof

Technical User
Jan 21, 2003
8
CA
Hi...

I have a web page with and Applet wich has a ActiveX Control on it. This applet also has a button.
When I load the web page it calls a style sheet file, with an OBJECT selector that sets the ActiveX Control hidden.
What I want to do is: when I click on the button it loads another applet with the same ActiveX control on it, but visible.
How can I do this with javascript ???
I write a function for the button in javascript that calls the OBJECT in the style sheet and changes it's visibility property to Visible???

Please help...

Thanks...
 
give the object an id attribute, then use javascript to alter its style properties:

<object id=&quot;myObject1&quot;/>

<script>
document.getElementById(&quot;myObject1&quot;).style.display = &quot;block&quot;;
</script>

=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
I'm using a javascript file that includes the function code to change the visibility of the ActiveX Control. Do I use the same syntax to change it ??
in html file: <object id=&quot;myobject&quot;>
in css file: OBJECT {display:none; visibility:hidden;} -> called when web page loads
in js file: function MyFunction(){document.getElementById(&quot;myObject1&quot;).style.display = &quot;block&quot;; }

can I do this ???

thanks
 
yes, but the id attributes must match identically between the html and javascript.

in html file: <object id=&quot;myobject&quot;>
in css file: OBJECT {display:none; visibility:hidden;} -> called when web page loads
in js file: function MyFunction(){document.getElementById(&quot;myobject&quot;).style.display = &quot;block&quot;; }


=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
I'm getting an error that says that &quot;object does not suport this property&quot;.
I guess it has something to do with calling document.getElementById(&quot;...&quot;).style.display = ...
What do you think ??
 
watch out to. because I've had problems with this very thing (hideing/showing activeX) crashing IE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top