Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by chengshwu on Aug 15, 2009 09:56
open dhtmlx forum
how to use js file intead of codes in page?

formally ,I defined the js scripts in page as following:
<body>
<div id="gridbox" width="100%" height="100%" style="background-color:white;overflow:hidden"></div>
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../scripts/appjs/dhtmlxGrid/codebase/imgs/");
mygrid.setHeader("a, b,c");
mygrid.setInitWidths("50,50,200");
mygrid.setColAlign("right,left,left");
</scripts>
</body>

now I want to put the script in a js file ,and include the js file in the page.I try to put the js scripts in a js file and include it in the page,it can not work correctly

<script language="JavaScript" src="myscripts.js"></script>

what should i do?
Answer posted by dhxSupport on Aug 17, 2009 00:47
Try to place your scripts inside function which will be called on body's load:
<body onload="doInitGrid()">