•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 375,172 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,102 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1335 | Replies: 1
![]() |
•
•
Join Date: Sep 2006
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 1
[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<head>
<title></title>
<style type="text/css">
.nodisplay{
display: none;
}
</style>
<script type="text/javascript">
<!--
var theElement;
theElement = document.getElementById("test");
theElement.className="nodisplay";
-->
</script>
</head>
<body>
<div id="test"> CSS Rules in Action </div>
</body>
</html>]
I want this text to disappear, but I get object theElement is undefined or null. Help I think it is simple
<head>
<title></title>
<style type="text/css">
.nodisplay{
display: none;
}
</style>
<script type="text/javascript">
<!--
var theElement;
theElement = document.getElementById("test");
theElement.className="nodisplay";
-->
</script>
</head>
<body>
<div id="test"> CSS Rules in Action </div>
</body>
</html>]
I want this text to disappear, but I get object theElement is undefined or null. Help I think it is simple
<div id="test"> doesn't exist when your script is being run. Usually, when you are working with the DOM, you would like to wait untill the whole DOM is loaded.
try running your code afer the window is loaded.
window.onload = function() {
// .. your code
};
or use the specific event attachment functions for different browsers.
Edit: I meant "event handler" attachment functions...
try running your code afer the window is loaded.
window.onload = function() {
// .. your code
};
or use the specific event attachment functions for different browsers.
Edit: I meant "event handler" attachment functions...
Last edited by digital-ether : Nov 6th, 2006 at 1:04 am.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Rich Text Box Code (HTML and CSS)
- Javascript help! (JavaScript / DHTML / AJAX)
- <h1><h2> and <b> tags (Search Engine Optimization)
- Please help a newbie - Javascript basic (JavaScript / DHTML / AJAX)
- how to start seo for zero rank site (Search Engine Optimization)
- Automatically populate text box with browser info... (JavaScript / DHTML / AJAX)
- trying to improve my site (Search Engine Optimization)
- hover over text tips (JavaScript / DHTML / AJAX)
- Capturing data from txt file using JavaScript/HTML (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Content Breaking thru Borders
- Next Thread: Submit or action button


Linear Mode