0

Hi I have below javascript code

<SCRIPT language="javascript">
function validate(){
	if(document.r_requisition.r_project_name.value=="deny"){
	alert ("You are not authorised to any project ");
	return false;
	}
	if(document.r_requisition.r_number.value==""){
	alert ("input in req No.");
	return false;
	}
	if(document.r_requisition.r_delv_date.value==""){
	alert ("input Delivery Date: ");
	return false;
	}
	
}
</script>

Its working fine. But when I saved this file and write to my document header section

<script type="text/javascript" src="js/r_validate.js"></script>

its not working. can anybody solve this

5
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Taywin
0

Have u tried accessing the script directly in the browser, by calling the file in the browser? cause sometimes you are just not accessing the file, the location of the file could be incorrect. maybe it is another level up, also ensure that the file is saved the same way u are calling it.

I know the above sounds silly and one cannot possibly have gotten that wrong, but we are human and make mistakes, sometimes its just the simple things we get wrong

0

Hi I have below javascript code

<SCRIPT language="javascript">
function validate(){
	if(document.r_requisition.r_project_name.value=="deny"){
	alert ("You are not authorised to any project ");
	return false;
	}
	if(document.r_requisition.r_number.value==""){
	alert ("input in req No.");
	return false;
	}
	if(document.r_requisition.r_delv_date.value==""){
	alert ("input Delivery Date: ");
	return false;
	}
	
}
</script>

Its working fine. But when I saved this file and write to my document header section

<script type="text/javascript" src="js/r_validate.js"></script>

its not working. can anybody solve this

Don't forget to remove the <script...> tags from the source file!

0

1. As Troy III said, you are not supposed to have 'script' tag inside a .js file. If you have it, remove it.
2. Where is the .js file? Is it in where it is supposed to be -- js folder? Assuming your HTML file is in folder 'myHTML', your js file should be in 'myHTML/js' folder.
3. Your js code is hard-coded -- calling DOM directly. Make sure that all elements match those that are referring by your js code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.