如何在jsp中包含js文件

时间:2017-05-31 00:34:02

标签: javascript jsp java-ee

我是jee的初学者。我想在我的jsp文件中包含一个js文件。

jsp文件:
<script type="text/javascript" src="js/controle_button.js"> </script>

js file:

function ajout()
{
	alert("ok");
	i++;
	var temp = "environement" +i;
	var div = document.createElement('div');
	div.innerHTML = '<label>'+temp+'<span class="requis"></span></label> <input type="text" name="environement+'+i+'" ><input type="button" id="add_kid()" onClick="ajout()" value="+" /><input type="button" value="-" onclick="removeKid(this)">';
	
	document.getElementById('env').appendChild(div);
	}
function removeKid(div) {	
    document.getElementById('env').removeChild( div.parentNode );
	i--;
}

1 个答案:

答案 0 :(得分:0)

你好,谢谢你的帮助我的问题的解决方案只是将JS文件夹移动到WebContent文件夹再次谢谢你。