PDA

View Full Version : Why is onReady not fireing in this html



mohaaron
1 Aug 2009, 8:09 AM
This maybe more of a JavaScript problem but I want to ask here since I'm trying to make Ext work in this case. Can anyone tell me why this code doesn't work?



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>

<body>

<script src="/Website/Common/Scripts/ext-3.0.0/adapter/ext/ext-base.js" type="text/javascript" />
<script src="/Website/Common/Scripts/ext-3.0.0/ext-all-debug.js" type="text/javascript" />


<script type="text/javascript" language="javascript">
alert('JavaScript executing...');

Ext.onReady(function() {
alert('Ext.onReady()');
});
</script>


</body>
</html>

Animal
1 Aug 2009, 8:20 AM
Do you get the alert?

What error does Firebug report? "Ext is undefined"?

mohaaron
1 Aug 2009, 8:33 AM
Thanks for the reply Animal. I was just about to go back and edit my post to say what your asking.

No, the alert never fires and I don't get any error in Firebug. I nothing but a blank web page.

Animal
1 Aug 2009, 8:40 AM
You're saying your browser just is not working then?

It does not process <script> tags in web pages?

So no Ext pages work in your browser?

mohaaron
1 Aug 2009, 8:52 AM
I do have other pages using Ext that do work, I just don't understand what's going on with this simple example.

Here is a screen shot of the html tab of Firebug.

Animal
1 Aug 2009, 8:54 AM
WHAT did you post that for eh?

Can YOU read it?

steffenk
1 Aug 2009, 8:58 AM
Look to your DOM! There is extbase included and nothing else! No ext-all.js, no script, nothing!!!

Animal
1 Aug 2009, 9:01 AM
The code looks like it should include ext-all-debug.js.

If there was a 404, then there should be an error message on the Firebug console.

SAnDAnGE
1 Aug 2009, 10:02 AM
Closing <script> tag is mandatory



<script src="/Website/Common/Scripts/ext-3.0.0/adapter/ext/ext-base.js" type="text/javascript" />
<script src="/Website/Common/Scripts/ext-3.0.0/ext-all-debug.js" type="text/javascript" />


should be replaced by:



<script src="/Website/Common/Scripts/ext-3.0.0/adapter/ext/ext-base.js" type="text/javascript">
</script>
<script src="/Website/Common/Scripts/ext-3.0.0/ext-all-debug.js" type="text/javascript">
</script>

Animal
1 Aug 2009, 10:17 AM
The shortened form should be OK in XHTML. The posted code validates at the W3 validator.

mohaaron
1 Aug 2009, 2:48 PM
Sorry about the bad screen shot. I didn't expect it to get so small and hard to see. I'm still working on trying to figure out what's going on. I really don't understand what I see happening.

I can view source on the page and see everything as it should be, meaning all the script tags are present.

When I view the Firebug html tab I see that ext-all-debug.js script tag is missing and the javascript tag with the Ext.onReady code is also missing.

Why would I see these tags in the source but not in the Firebug html tab?

This is the first time I have ever seen html tags go missing like this.

Can anyone tell me how to make a good screen shot so I can show you what I am seeing in the Firebut console?

Animal
1 Aug 2009, 10:33 PM
Try putting the script tags in the <head> element.

SAnDAnGE
1 Aug 2009, 10:47 PM
With his source code:

http://www.sandange.ro/temp/Firebug%20original.PNG
http://www.sandange.ro/temp/Google Chrome original.PNG


With the changes written by me in the previous post:

http://www.sandange.ro/temp/Firebug%20with%20changes.PNG
http://www.sandange.ro/temp/Google%20Chrome%20with%20changes.PNG

mohaaron
2 Aug 2009, 11:54 AM
Wow, thank you so much. That was the problem. The script tags have to have closing tags. The xhtml does not work in this case. Is this a browser issue?

In any case I now will try and figure out how I ended up with script tags using xhtml. I think that visual studio must be creating the tags this way when I drag and drop a file into the page.

Thank everyone for the help.