View Full Version : Calling javascript

09-11-2008, 12:02 AM
A parent.jsp page is constructed as:

<script language="JavaScript" type="text/javascript" src="js/test.js?</script>

<div id="placeHolder">


Later on at the run time, the div section will be dynamically loaded by the returned child.jsp (from the server side), which contains:

<input type="button" value="test" onclick="test()" />

--Now, if I put the test() function inside the test.js, such as

<script type="text/javascript" language="javascript">function test(){ alert("testing");} </script>

onclick will trigger the function.

--But, if I put the same function in the child.jsp page, instead. onclick can NEVER trigger the function.



Dynamical loading used: document.getElementById("...").innerHTML="..."
Yes, I also changed and resaved the parent.jsp.