PDA

View Full Version : impossible load javascript with loadobjs



octoporos
06-05-2008, 05:51 AM
Hi, I think that is a very recurrent problem but I donīt find the solution. I've problem loading the javascript using ajax. the code of the "accordion"page is:

<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
</head>
<body>

<p>Welcome </p>


<div id="Accordion1" class="Accordion" tabindex="0">
<div class="AccordionPanel">
<div class="AccordionPanelTab">TAB1</div>
<div class="AccordionPanelContent">Content1</div>
</div>
<div class="AccordionPanel">
<div class="AccordionPanelTab">TAB 2</div>
<div class="AccordionPanelContent">Content2 </div>
</div>
</div>
<script type="text/javascript">
<!--
var Accordion1 = new Spry.Widget.Accordion("Accordion1");
//-->
</script>

here's the code http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

I can load the css file with loadobjs(), but not the js file and the little script included into the accordion page.

radostsguy
06-05-2008, 10:32 AM
Speaking with zero knowledge of "ajax" "accordions", etc, it stikes me that your .js and .css loading statements are simple HTML. What does ajax have to do with it? I don't see why it doesn't work either. But there are a couple of maybe's. Here's what I use for the .js files:

<script language="JavaScript" type="text/javascript" src='css/smilies.js'></SCRIPT>

Maybe it's balking because you don't have the language ="JavaScript" part.

Also, I always put my CSS first. Seems to me I learned that somehow back when T-Rexes were circling our camp looking for a meal. It's worth a try.

octoporos
06-05-2008, 04:10 PM
Thanks for you answer radostsguy!! But it's not just simple html, the javascript activate de accordion panel. And I try your solution but don't work.

Anyone else please?