<html>
<head>
</head>
<body><a>
<script type="text/javascript">
window.onload = function(){
showval();
$('username').focus();
$('username').onkeydown = function(){
if(event.keyCode == 13){
$('password').select();
}
}
$('password').onkeydown = function(){
if(event.keyCode == 13){
chklg();
window.open('http://www.sohu.com','found','width=300,height=200')
}
} function test(){
chklog();
window.open('http://192.168.0.253/search/search.html','found','width=300,height=200')
}
function chklg(){
if($('username').value != "sa"){
alert('用户名输入错误');
$('username').select();
return false;
}
if($('username').value == ''){
alert('请输入用户名!');
$('username').focus();
return false;
}
if($('password').value != "sa"){
alert('密码输入错误');
$('password').select();
return false;
}
if($('password').value == ''){
alert('请输入密码!');
$('password').focus();
return false;
}
}</script>
<div style=" border:1px #ddd solid; overflow:hidden;text-align:center; float:center; margin:100px;">
<div style="textalign=center; margin-top:10px; margin-left:auto">
<div><p>用户名:<input type=text; style="width:160px"; id="username"; name="username"></input></p></div><div id=usr></div>
</div>
<div style="position:relative; margin-top:10px; margin-left:auto;">
<div><p>密码: <input type="password"; style="width:160px"; id=password; name=password></input></p></div>
<div id=pwd></div>
</div>
<div style="margin-top:10px;margin-left:50px;"><input style="width:70px" type="submit"; value="登录" onclick='test()'></input></div>
</div>
</a></body></html>
<head>
</head>
<body><a>
<script type="text/javascript">
window.onload = function(){
showval();
$('username').focus();
$('username').onkeydown = function(){
if(event.keyCode == 13){
$('password').select();
}
}
$('password').onkeydown = function(){
if(event.keyCode == 13){
chklg();
window.open('http://www.sohu.com','found','width=300,height=200')
}
} function test(){
chklog();
window.open('http://192.168.0.253/search/search.html','found','width=300,height=200')
}
function chklg(){
if($('username').value != "sa"){
alert('用户名输入错误');
$('username').select();
return false;
}
if($('username').value == ''){
alert('请输入用户名!');
$('username').focus();
return false;
}
if($('password').value != "sa"){
alert('密码输入错误');
$('password').select();
return false;
}
if($('password').value == ''){
alert('请输入密码!');
$('password').focus();
return false;
}
}</script>
<div style=" border:1px #ddd solid; overflow:hidden;text-align:center; float:center; margin:100px;">
<div style="textalign=center; margin-top:10px; margin-left:auto">
<div><p>用户名:<input type=text; style="width:160px"; id="username"; name="username"></input></p></div><div id=usr></div>
</div>
<div style="position:relative; margin-top:10px; margin-left:auto;">
<div><p>密码: <input type="password"; style="width:160px"; id=password; name=password></input></p></div>
<div id=pwd></div>
</div>
<div style="margin-top:10px;margin-left:50px;"><input style="width:70px" type="submit"; value="登录" onclick='test()'></input></div>
</div>
</a></body></html>
function $(e) {
return document.getElementById(e);
}
<html>
<head>
</head>
<body><a>
<script type="text/javascript">
window.onload = function(){
function $(id){
return document.getElementById(id);
}
$('username').focus();
$('username').onkeydown = function(){
if(event.keyCode == 13){
$('password').select();
}
}
$('password').onkeydown = function(){
if(event.keyCode == 13){
chklg();
window.open('http://www.sohu.com','found','width=300,height=200')
}
} function test(){
chklog();
window.open('http://192.168.0.253/search/search.html','found','width=300,height=200')
}
function chklg(){
if($('username').value != "sa"){
alert('用户名输入错误');
$('username').select();
return false;
}
if($('username').value == ''){
alert('请输入用户名!');
$('username').focus();
return false;
}
if($('password').value != "sa"){
alert('密码输入错误');
$('password').select();
return false;
}
if($('password').value == ''){
alert('请输入密码!');
$('password').focus();
return false;
}
}</script>
<div style=" border:1px #ddd solid; overflow:hidden;text-align:center; float:center; margin:100px;">
<div style="textalign=center; margin-top:10px; margin-left:auto">
<div><p>用户名:<input type=text; style="width:160px"; id="username"; name="username"></input></p></div><div id=usr></div>
</div>
<div style="position:relative; margin-top:10px; margin-left:auto;">
<div><p>密码: <input type="password"; style="width:160px"; id=password; name=password></input></p></div>
<div id=pwd></div>
</div>
<div style="margin-top:10px;margin-left:50px;"><input style="width:70px" type="submit"; value="登录" onclick="test()"></input></div>
</div>
</a></body></html>
return document.getElementById(e);
} 这段函数也不行啊
function $(id){
return document.getElementById(id);
}
window.onload = function(){
$('username').focus();
。
<html>
<head>
</head>
<body><a>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}
window.onload = function(){ $('username').focus();
$('username').onkeydown = function(){
if(event.keyCode == 13){
$('password').select();
}
}
$('password').onkeydown = function(){
if(event.keyCode == 13){
chklg();
window.open('http://www.sohu.com','found','width=300,height=200')
}
} function test(){
chklog();
window.open('http://192.168.0.253/search/search.html','found','width=300,height=200')
}
function chklg(){
if($('username').value != "sa"){
alert('用户名输入错误');
$('username').select();
return false;
}
if($('username').value == ''){
alert('请输入用户名!');
$('username').focus();
return false;
}
if($('password').value != "sa"){
alert('密码输入错误');
$('password').select();
return false;
}
if($('password').value == ''){
alert('请输入密码!');
$('password').focus();
return false;
}
}</script>
<div style=" border:1px #ddd solid; overflow:hidden;text-align:center; float:center; margin:100px;">
<div style="textalign=center; margin-top:10px; margin-left:auto">
<div><p>用户名:<input type=text; style="width:160px"; id="username"; name="username"></input></p></div><div id=usr></div>
</div>
<div style="position:relative; margin-top:10px; margin-left:auto;">
<div><p>密码: <input type="password"; style="width:160px"; id=password; name=password></input></p></div>
<div id=pwd></div>
</div>
<div style="margin-top:10px;margin-left:50px;"><input style="width:70px" type="submit"; value="登录" onclick="test()"></input></div>
</div>
</a></body></html>
<head>
</head>
<body><a>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}
window.onload = function(){$('username').focus();$('username').onkeydown = function(){
if(event.keyCode == 13){
$('password').select();
}
}
$('password').onkeydown = function(){
if(event.keyCode == 13){
chklg();
window.open('http://www.sohu.com','found','width=300,height=200')
}
}
} //<== 这里少了闭弧function test(){
chklog(); //<== 这个函数未定义
window.open('http://192.168.0.253/search/search.html','found','width=300,height=200')
}function chklg(){
if($('username').value != "sa"){
alert('用户名输入错误');
$('username').select();
return false;
}
if($('username').value == ''){
alert('请输入用户名!');
$('username').focus();
return false;
}
if($('password').value != "sa"){
alert('密码输入错误');
$('password').select();
return false;
}
if($('password').value == ''){
alert('请输入密码!');
$('password').focus();
return false;
}
}</script>
<div style=" border:1px #ddd solid; overflow:hidden;text-align:center; float:center; margin:100px;">
<div style="textalign=center; margin-top:10px; margin-left:auto">
<div><p>用户名:<input type=text; style="width:160px"; id="username"; name="username"></input></p></div><div id=usr></div>
</div>
<div style="position:relative; margin-top:10px; margin-left:auto;">
<div><p>密码: <input type="password"; style="width:160px"; id=password; name=password></input></p></div>
<div id=pwd></div>
</div>
<div style="margin-top:10px;margin-left:50px;"><input style="width:70px" type="submit"; value="登录" onclick="test()"></input></div>
</div>
</a></body></html>
window.open('http://192.168.0.253/search/search.html','found','width=300,height=200')
}function chklg(){ ----> 这里不是有函数体么? 不好意思初学编程不是很懂,该怎么定义函数?
if($('username').value != "sa"){
window.open('http://192.168.0.253/search/search.html','found','width=300,height=200')
}function chklg(){ ----> 这里不是有函数体么? 不好意思初学编程不是很懂,该怎么定义函数?
if($('username').value != "sa"){睁大眼睛看看,是一样吗?
chklog
chklg
多个o