PDA

View Full Version : Javascript file not being loaded


roadrunnerray
11-15-2006, 04:21 PM
I have a test XSL page that requests a javascript file be loaded. The code is as follows:

=======================
<html>
<head>
<title>Test two menus</title>
<script language="JavaScript" type="text/javascript" src="http://128.123.83.183/js/prototype.js"/>
<script language="JavaScript" type="text/javascript" src="http://128.123.83.183/js/twomenus.js"/>
</head>
<body>
<xsl:attribute name="onload">
<xsl:value-of select="concat('set_menu2(',$menu1_id,')')"/>
</xsl:attribute>
<form name="menus" id="menus">
<table>
<tr>
<td>
<select name="menu1" onchange="set_menu2(document.menus.menu1.options[this.selectedIndex].value)">
<xsl:for-each select="$menu1/fmrs:fmresultset/fmrs:resultset/fmrs:record">
<xsl:variable name="record" select="current()"/>
<option value="{$record/fmrs:field[@name = 'department_id']/fmrs:data[1]}">
<xsl:value-of select="$record/fmrs:field[@name = 'department']/fmrs:data[1]"/>
</option>
</xsl:for-each>
</select>
</td>
<td>
<div id="menu2"/>
</td>
</tr>
</table>
===========================
Link:
http://128.123.83.183/fmi/xsl/Registration%20DB%20XSLT-Test/twomenus.xsl

The javascript files do not load for some reason. The web server hosting the xsl and javascript files runs OSX Server 10.3.9. I have checked the permissions and MIME type settings and they appear to be OK. any thoughts will be greatly appreciated.........Ray

david_kw
11-15-2006, 05:32 PM
Looking at your example link it appears the src attribute is being stripped out on transformation.

Maybe try:


<script type="text/javascript" language="JavaScript">
<xsl:attribute name="src">
<xsl:text>http://128.123.83.183/js/prototype.js</xsl:text>
</xsl:attribute>
</script>


david_kw

roadrunnerray
11-15-2006, 06:03 PM
Hi David, thanks for your suggestion. I used your code and the "src" attribute was displayed properly but it still is not bringing in the actual javascript file................Ray

david_kw
11-15-2006, 06:36 PM
Putting the generated URL directly in a browser gives a 404 error. Maybe check to make sure the .js file itself is in the right place?

david_kw

roadrunnerray
11-15-2006, 06:41 PM
Thanks David, what should one get by placing the generated URL in the browser if the js file was in the correct directory/folder?........Ray

david_kw
11-15-2006, 06:47 PM
On my browser I get the option to download it. Try this:

http://www.exfer.net/js/zxml.src.js

david_kw

david_kw
11-15-2006, 06:50 PM
But your generated URL is this:

http://128.123.83.183/fmi/xsl/Registration%20DB%20XSLT-Test/js/twomenus.js

which give me a 404 error file not found.

david_kw

roadrunnerray
11-15-2006, 06:57 PM
Thanks again David, I am running IE 7.0 (just downloaded it). I may have a problem with permissions on the OSX server. I am going to try another browser and then look into the server settings. I very much appreciate your efforts and will report back with my findings..............Ray

roadrunnerray
11-15-2006, 07:12 PM
Putting the generated URL directly in a browser gives a 404 error. Maybe check to make sure the .js file itself is in the right place?

david_kw

David, I will first take your suggestion and verify that the file has been placed in the proper location on the server............Ray

david_kw
11-15-2006, 07:12 PM
Good luck! BTW, You might want to try putting it in the same directory as the xsl file to test. I can't recall for sure but I think if permissions are wrong you get a different error (maybe 403?). It's my understanding that 404 should mean the file isn't in that location.

david_kw

roadrunnerray
11-15-2006, 08:08 PM
Good luck! BTW, You might want to try putting it in the same directory as the xsl file to test. I can't recall for sure but I think if permissions are wrong you get a different error (maybe 403?). It's my understanding that 404 should mean the file isn't in that location.

david_kw

I have tried a number of locations including the one I have the xsl in. I am going to try a few other locations as I believe you are correct that this is the problem. Many thanks................Ray

A1ien51
11-15-2006, 08:19 PM
FYI:

<script language="JavaScript" type="text/javascript" src="http://128.123.83.183/js/prototype.js"/>

Most browsers do not support the empty notation for external JavaScript files. You need to have the closing </script> tag.

Eric

roadrunnerray
11-15-2006, 08:28 PM
FYI:

<script language="JavaScript" type="text/javascript" src="http://128.123.83.183/js/prototype.js"/>

Most browsers do not support the empty notation for external JavaScript files. You need to have the closing </script> tag.

Eric

Thanks Eric, when I used david_kw's coding suggestion above it included the </script>. I have made note of this for future use......Ray

A1ien51
11-15-2006, 08:31 PM
Thanks Eric, when I used david_kw's coding suggestion above it included the </script>. I have made note of this for future use......Ray

Crap I looked through the posts to see if someone changed that and did not see it. Guess I should avoid coding for the next two hours!

Eric

roadrunnerray
11-15-2006, 10:18 PM
Crap I looked through the posts to see if someone changed that and did not see it. Guess I should avoid coding for the next two hours!

Eric

Might be the "Cave Dwelling" is getting to you!! Thanks for your thoughts.................Ray