首页 > IT职业 > IT图书 > php加载javascript的方法
1、将javascript写成js文件,然后在php文件中将js文件放到
部分。2、直接将javascript脚本写到php文件中。
或都可。function notnullcheck()
{
var hostname=document.getElementById("host").value;
var name=document.getElementById("username").value;
var pass=document.getElementById("password").value;
if(hostname=="")
{
alert("服务器地址不能为空!");
return false;
}
if(name=="")
{
alert("用户名不能为空!");
return false;
}
if(pass=="")
{
alert("密码不能为空!");
return false;
}
}
3、通过
echo "";
加载js文件。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1369/viewspace-2802067/ ,如需转载,请注明出处,否则将追究法律责任。