473,807 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I make an object visible with javascript and CSS

106 New Member
I have this on my css style:

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. #container
  3. {visibility:hidden;
  4.    width: 1000px;
  5.    position: relative;
  6.    margin-top: 0px;
  7.    margin-left: auto;
  8.    margin-right: auto;
  9.    text-align: left;
  10. }
  11. </style>
Then, I have this javascript code:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript"> 
  2. window.onload=function(){
  3.     document.getElementById("container").style.display="???";
  4. }
  5. </script>
What I want to do, is to make the #container visible on page load.

But as I'm a newbie on css and javascript, I don't know what to put on style.display=" ???"; to make it visible.

I only know that if I put style.display=" none"; it will not display #container.

What do I put to make it display?

Thanks to anyone who can help me.
May 5 '10 #1
15 5156
drhowarddrfine
7,435 Recognized Expert Expert
Depending on what kind of element #container is, assuming it's a div, set it to 'block'.
May 5 '10 #2
londres9b
106 New Member
I did that, but nothing appeared anyway

but thanks, I'll check again.
May 5 '10 #3
Dormilich
8,658 Recognized Expert Moderator Expert
you still have visibility set to "hidden". display is a completely different thing.
May 5 '10 #4
londres9b
106 New Member
Then how do I make the div appear on page load?
May 6 '10 #5
Dormilich
8,658 Recognized Expert Moderator Expert
set the visibility to "visible"
May 6 '10 #6
londres9b
106 New Member
yes, i know, but that's in the css style!

I want in the javascript
May 7 '10 #7
Dormilich
8,658 Recognized Expert Moderator Expert
then change the CSS in JavaScript.
May 8 '10 #8
londres9b
106 New Member
How do I do that?

I have

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript"> 
  2. window.onload=function(){
  3.     document.getElementById("container").style.display="???";
  4. }
  5. </script>
How do I put css on that javascript?

P.S. thanks for the help
May 8 '10 #9
Dormilich
8,658 Recognized Expert Moderator Expert
How do I put css on that javascript?
you can use any CSS property via the JavaScript style object (like you did in the example with the display property).

but your CSS rule is not about display, it's about visibility.
May 8 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1038
by: weichung[MCSD,MCDBA] | last post by:
Hi, I am currently having a .net Object whcih had been written in the code behind. However, I wish to avoid a round trip from the client to server (postback). Therefore I am wondering how could I achieve this? Is it possible by declaring the object in javascript and perform the object's method in the client side? Any ideas are welcome, Thanks
4
1166
by: tshad | last post by:
I am trying to set some labels to display calculated values with posting back to the server. So I am using Javascript to set the values of my asp:label. The problem is that an asp:lavel renders into a span element. For example: function SalaryDisplay(me) { var salaryMinLabel = document.getElementById("SalaryMin"); salaryMinLabel.value = 200;
1
1122
by: Anbu | last post by:
All, I'm developing an website using ASP .NET. I have developed a menu structure based on JavaScript. This JavaScript file is called by an UserControl to generate the menus. It works fine for the WebPage that lies in the same folder. But when i use the same control in another page (another directory) it's not working property. It shows an error "Object Required".
1
2068
by: Steve Sobol | last post by:
http://gallery.stevesobol.com/activex-plain.html works in Firefox 1.5 and Opera 9 but not in IE 6, and I can't figure out why. The IE developer toolbar's DOM inspector shows the OBJECT tag and the PARAM tags inside it, and if I don't have the Javascript in an external file, I'll get the "click here to activate" tooltip and the border around what is supposed to be the Flash movie. If I right-click inside the border, I get the Flash...
4
2755
by: andrei.csibi | last post by:
I've have a .NET Assembly, which is COM Visible. I would like to load objects from this assembly in javascript code. E.g. Assembly Book.dll has the class Book and I would like to use <script language="javascript" type="text/javascript"> var book = new Book(); document.write(book.Title); </script> Even more, if I could access book through the document object it would be even more helpful, like: <script language="javascript"...
1
2016
by: Saurabh | last post by:
i want to create a table dynamically. Right now what i am using is a string harcoded with the table structure with "<TD>"+values i want to fill in the table dynamically. and then padd this string to divID.innerHTML; Is there a table object in javascript? if there is How to use it????
6
10300
by: MayBoy | last post by:
Hi There I am trying to use the Goto method of the Word ActiveX object. I am trying to open a document and go to a named bookmark. If I use this code in VB it works, so I'm sure the approach is possible, I just can't get JavaScript to work with it. Here is the code I am using, the error I get from IE is Object Expected: Hope someone can help! Any help would be much appreciated
7
7325
by: Rob | last post by:
Hi, I'm getting an error on my login page when using Javascript session object. It works on the development server so I'm wondering if there is a setting in IIS to allow using sessions on the server. When the user clicks on the submit button after entering their username and password, it calls a function (below) and I get an "Object expected" javascript error. This is the function:
0
9599
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10112
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3854
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.