473,804 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getElementById driving me crazy

the browser is firefox

the javascript:

function slideshowchecke r(){

if(document.get ElementById){al ert('it works');}
slide = document.getEle mentById("slide X");

if(slide==null) {
alert('yes2');
}

}
window.onload=s lideshowchecker ();

the document has a div id = slideX.
both alerts keep coming up.

here is the html

<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><ti tle>slideshow</title><script

src="jscripts/GTA.js" ></head><body><div class="slide" id="slideX">
grrrrrrrr

</div></body></html>

Why is slideX coming up null?

I'm really tired, I've been working from noon to 9 pm yesterday and
from 1 am to 5 am this morning.

May 13 '07 #1
3 1288
On May 13, 5:40 am, pantag
oh wait, just realized, the script is executing before the div exists
so slide is null.

ruel <rasmussen.br.. .@gmail.comwrot e:
the browser is firefox

the javascript:

function slideshowchecke r(){

if(document.get ElementById){al ert('it works');}
slide = document.getEle mentById("slide X");

if(slide==null) {
alert('yes2');

}
}

window.onload=s lideshowchecker ();

the document has a div id = slideX.
both alerts keep coming up.

here is the html

<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><ti tle>slideshow</title><script

src="jscripts/GTA.js" ></head><body><div class="slide" id="slideX">
grrrrrrrr

</div></body></html>

Why is slideX coming up null?

I'm really tired, I've been working from noon to 9 pm yesterday and
from 1 am to 5 am this morning.

May 13 '07 #2
pantagruel wrote:
ruel <rasmussen.br.. .@gmail.comwrot e:
>the browser is firefox

the javascript:

function slideshowchecke r(){

if(document.ge tElementById){a lert('it works');}
slide = document.getEle mentById("slide X");

if(slide==null ){
alert('yes2' );

}
}

window.onload= slideshowchecke r();
window.onload = slideshowchecke r;

Don't use the call operator, when assigning functions to events.

If you need to pass the event:

window.onload = function(e) { alert('on' + e.type); }

If you need to pass arguments:

window.onload = function()
{
func1('arg1', 'arg2');
}
>the document has a div id = slideX.
both alerts keep coming up.

here is the html

<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><t itle>slideshow</title><script

src="jscript s/GTA.js" ></head><body><div class="slide" id="slideX">
grrrrrrrr

</div></body></html>

Why is slideX coming up null?

I'm really tired, I've been working from noon to 9 pm yesterday and
from 1 am to 5 am this morning.
<attempt to fix top post>
On May 13, 5:40 am, pantag
oh wait, just realized, the script is executing before the div exists
so slide is null.
What is "GTA.js?" I ask only because I am a Grand Theft Auto fanatic.
If it has something to do with that, you must share. :)

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
May 13 '07 #3
Thanks for the help, no actually it isn't Grand Theft Auto, sorry.
Hmm, maybe I should reconsider my acronym.

Cheers,
Bryan Rasmussen

On May 13, 6:09 am, -Lost <maventheextraw o...@techie.com wrote:
pantagruel wrote:
ruel <rasmussen.br.. .@gmail.comwrot e:
the browser is firefox
the javascript:
function slideshowchecke r(){
if(document.get ElementById){al ert('it works');}
slide = document.getEle mentById("slide X");
if(slide==null) {
alert('yes2');
}
}
window.onload=s lideshowchecker ();

window.onload = slideshowchecke r;

Don't use the call operator, when assigning functions to events.

If you need to pass the event:

window.onload = function(e) { alert('on' + e.type); }

If you need to pass arguments:

window.onload = function()
{
func1('arg1', 'arg2');

}
the document has a div id = slideX.
both alerts keep coming up.
here is the html
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><ti tle>slideshow</title><script
src="jscripts/GTA.js" ></head><body><div class="slide" id="slideX">
grrrrrrrr
</div></body></html>
Why is slideX coming up null?
I'm really tired, I've been working from noon to 9 pm yesterday and
from 1 am to 5 am this morning.

<attempt to fix top post>
On May 13, 5:40 am, pantag
oh wait, just realized, the script is executing before the div exists
so slide is null.

What is "GTA.js?" I ask only because I am a Grand Theft Auto fanatic.
If it has something to do with that, you must share. :)

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.

May 15 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2536
by: dont bother | last post by:
This is really driving me crazy. I have a dictionary feature_vectors{}. I try to sort its keys using #apply sorting on feature_vectors sorted_feature_vector=feature_vectors.keys() sorted_feature_vector.sort() #feature_vector.keys()=sorted_feature_vector
6
46576
by: John Ramsden | last post by:
.... when the id 'junk' doesn't exist anywhere in the document, instead of returning 'object'?! I am using Javascript for a drop-down menu, slightly adapted from one by Angus Turnbull (see http://javascript.internet.com and http://gusnz.cjb.net, not that this is probably relevant but it deserves a plug ;-), on Internet Explorer v6.0.2800.1106. I need this feature of getElementById(), or an equivalent one (using sound and standard...
6
1613
by: Keiron Waites | last post by:
Please see the problem in action here: http://www.leadbullet.biz/contact.php If you mouse over the fields, you will see that text is shown on the right. The text makes the other fields move when it is shown - even though the width of the text is less than the width of the field. WHY? This is driving me nuts - please help! TIA,
0
1312
by: Shapper | last post by:
Hello, I have this code in Global.asax: Sub Session_Start(Sender As Object, E As EventArgs) Dim cookie As HttpCookie = Request.Cookies("MyCookie") If Not cookie Is Nothing Then Response.Write(" * Cookie Exists * ") If Not cookie.Values("culture") Is Nothing
12
4059
by: bcr07548 | last post by:
I am writing a web site that uses JavaScript to validate certain forms and I seem to be having some trouble. The site uses PHP and for one of the forms, depending on the situation, one of of the text inputs does not exist - the PHP doesn't generate the HTML for it. I wanted to have the validation script check the length of the input if it exists but I knew that I might have trouble if I tried to check the value of the input without first...
5
1716
by: Pupeno | last post by:
Hello, I am experiencing a weird behavior that is driving me crazy. I have module called Sensors containing, among other things: class Manager: def getStatus(self): print "getStatus(self=%s)" % self return {"a": "b", "c": "d"} and then I have another module called SensorSingleton that emulates the
3
2284
by: rashpal.sidhu | last post by:
Please help, this problem is driving me crazy !! I am using metaphone to create phonetic keys. When i run the module stand-a-lone it works fine. I'm trying to create a runner for informix which includes the function in order to allow me to call it from within a 4gl program. When i do this i get differences in the key that is produced????? This only happens when metahpone translates an x in a name. The stand
5
1771
by: mark4asp | last post by:
Every time the function below is called I get the alert. So I put a deliberate error in there and I check the value of (reportType=='MANDATE') in Firebug, which is found to be true. But still the alert comes up. Why? I checked the following watch expressions at the blah blah point. id = 5843 reportType = "MANDATE"
2
3636
by: kheitmann | last post by:
OK, so I have a blog. I downloaded the "theme" from somewhere and have edited a few areas to suit my needs. There are different font themes within the page theme. Long story short, my "Text Posts" are supposed to be in the font: Georgia, but they are showing up in "Times New Roman"...blah! I can't find anything wrong in the code, but who am I trying to fool? I know nothing about this stuff. The code is below. The parts that I *think*...
0
9588
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
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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
7625
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
5527
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
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
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

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.