Jquery 以下代码未运行 请考虑以下代码,我试图整合:
第一部分:Jquery 以下代码未运行 请考虑以下代码,我试图整合:,jquery,html,coldfusion,dreamweaver,coldfusion-8,Jquery,Html,Coldfusion,Dreamweaver,Coldfusion 8,第一部分: <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jqu
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
我创建了一个登录表单(ColdFusion),并尝试运行代码,但不知道代码中有什么错误。如果我输入了错误的变量,请告诉我
以下是我到目前为止在Dreamweaver中使用的全部代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login Form</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script> var processFinish = false;
var tf_dialog_count;
var tf_dialog_counter;
function verifyMe(u,key,fname,status)
{
if(processFinish)
{
tf_dialog_count = 0;
return true; }
else {
if(typeof status === 'undefined')
{ $("body").append("<div id='tf_dialog'><p></p></div>");
var unameVal = $("#"+u).val();
var surl = 'http://someurl.com/username/filename.cfc?method=generateToken&uname='+unameVal+'&key='+key+'&callback=?';
var retRes = false;
$.getJSON(surl, function(data)
{
if(parseInt(data.RESULT) == 1)
{ $("#tf_dialog").html(data.MSG);
$("#tf_dialog").append("<br>Time Remaining <span id='tf_dialog_counter'></span> secs");
$("#tf_dialog").append("<br><span id='tf_dialog_waiting'>Waiting</span>");
$("#tf_dialog").dialog({ height: 200 });
tf_dialog_count = 20;
tf_dialog_counter=setInterval(timer, 1000);
setInterval(function() { verifyMe(unameVal,key,fname,'checkStatus'); },7000);
return false; }
else {
alert(data.MSG);
return false;
} }) }
else { if (tf_dialog_count > 0)
{ var surl = 'http://someurl.com/username/filename.cfc?method=getStatus&uname='+u+'&key='+key+'&callback=?';
$.getJSON(surl, function(data) { $("#tf_dialog_waiting").animate({fontSize:"22px"},3500,function(){ $(this).animate({fontSize:"10px"},3500); });
if(parseInt(data.RESULT) == 1)
{ processFinish = true; $('#'+fname).submit(); }
else { return false; } });
} } return false; } }
function timer()
{ tf_dialog_count=tf_dialog_count-1;
if (tf_dialog_count <= 0)
{ clearInterval(tf_dialog_counter); processFinish = false;
$("#tf_dialog").html("");
$("#tf_dialog").dialog("destroy");
$("#tf_dialog").remove();
alert("Time out. Please try again!!");
} $('#tf_dialog_counter').html(tf_dialog_count);
} </script>
</head>
<body>
<p> </p>
<div align = "center">
<cfform id = "form_id" action="" method="POST" onSubmit = "return verifyMe('<username_textbox_id>','<key>','<form_id>')">
Username:<br>
<br/>
<cfinput type="text" name="uname" id = "uname" />
<br>
<p> </p>
Password:<br/>
<br/>
<cfinput type="password" name="pwd" id="pwd" /><br>
<p> </p>
<cfinput type="submit" name="submit" value="Submit" />
</cfform>
</div>
</body>
</html>
登录表单
var processFinish=false;
变量tf_对话框_计数;
var tf_对话框_计数器;
功能验证(u、键、fname、状态)
{
if(processFinish)
{
tf_对话框_计数=0;
返回true;}
否则{
如果(状态类型===‘未定义’)
{$(“正文”)。追加(“”);
var unameVal=$(“#”+u).val();
var surl=http://someurl.com/username/filename.cfc?method=generateToken&uname=“+unameVal+”&key=“+key+”&callback=?”;
var-retRes=false;
$.getJSON(surl,函数(数据)
{
if(parseInt(data.RESULT)==1)
{$(“#tf_dialog”).html(data.MSG);
$(“#tf_对话框”)。追加(
剩余时间秒);
$(“#tf_dialog”).append(
Waiting”);
$(“#tf_dialog”).dialog({height:200});
tf_对话框_计数=20;
tf_对话框_计数器=设置间隔(计时器,1000);
setInterval(函数(){verifyMe(uneval,key,fname,'checkStatus');},7000);
返回false;}
否则{
警报(data.MSG);
返回false;
} }) }
else{if(tf_对话框计数>0)
{var surl='2〕http://someurl.com/username/filename.cfc?method=getStatus&uname=“+u+”&key=“+key+”&callback=?”;
$.getJSON(surl,函数(数据){$(“#tf_dialog_waiting”).animate({fontSize:“22px”},3500,function(){$(this).animate({fontSize:“10px”},3500);});
if(parseInt(data.RESULT)==1)
{processFinish=true;$('#'+fname).submit();}
else{return false;}});
}}返回false;}}
函数计时器()
{tf_dialog_count=tf_dialog_count-1;
如果(tf_对话框_计数
用户名:
密码:
您是否检查了浏览器的错误控制台?单击我的浏览器上的“提交”按钮后,什么也没有发生。我刚刚检查了浏览器的错误控制台,发现了以下类型的错误::-)@JuraKhrapunov我在实际代码中使用了尖括号。我应该用什么替换它?我不知道:-),这一切都取决于您希望如何处理提交的数据。当前表单提交给自己(标记的空“action”属性),这意味着您必须检测页面顶部的表单提交、处理数据并执行一些有用的操作:-)时间戳:6/26/2013 8:16:01 AM警告:分析“背景图像”的值时出错。声明已删除。源文件:http://l-stat.livejournal.com/??.8e797?v=1372155425行:368,列:19源代码:背景图像:-webkit渐变(线性,0%0%,0%100%,从(#FFF2F0)到(#FED4D3));
我希望您在实际的代码调用中不要使用尖括号,而只是将它们用作占位符,对吗?我的意思是在这个结构中:verifyMe(“”,,“”)
return verifyMe('<username_textbox_id>','<key>','<form_id>')
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login Form</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script> var processFinish = false;
var tf_dialog_count;
var tf_dialog_counter;
function verifyMe(u,key,fname,status)
{
if(processFinish)
{
tf_dialog_count = 0;
return true; }
else {
if(typeof status === 'undefined')
{ $("body").append("<div id='tf_dialog'><p></p></div>");
var unameVal = $("#"+u).val();
var surl = 'http://someurl.com/username/filename.cfc?method=generateToken&uname='+unameVal+'&key='+key+'&callback=?';
var retRes = false;
$.getJSON(surl, function(data)
{
if(parseInt(data.RESULT) == 1)
{ $("#tf_dialog").html(data.MSG);
$("#tf_dialog").append("<br>Time Remaining <span id='tf_dialog_counter'></span> secs");
$("#tf_dialog").append("<br><span id='tf_dialog_waiting'>Waiting</span>");
$("#tf_dialog").dialog({ height: 200 });
tf_dialog_count = 20;
tf_dialog_counter=setInterval(timer, 1000);
setInterval(function() { verifyMe(unameVal,key,fname,'checkStatus'); },7000);
return false; }
else {
alert(data.MSG);
return false;
} }) }
else { if (tf_dialog_count > 0)
{ var surl = 'http://someurl.com/username/filename.cfc?method=getStatus&uname='+u+'&key='+key+'&callback=?';
$.getJSON(surl, function(data) { $("#tf_dialog_waiting").animate({fontSize:"22px"},3500,function(){ $(this).animate({fontSize:"10px"},3500); });
if(parseInt(data.RESULT) == 1)
{ processFinish = true; $('#'+fname).submit(); }
else { return false; } });
} } return false; } }
function timer()
{ tf_dialog_count=tf_dialog_count-1;
if (tf_dialog_count <= 0)
{ clearInterval(tf_dialog_counter); processFinish = false;
$("#tf_dialog").html("");
$("#tf_dialog").dialog("destroy");
$("#tf_dialog").remove();
alert("Time out. Please try again!!");
} $('#tf_dialog_counter').html(tf_dialog_count);
} </script>
</head>
<body>
<p> </p>
<div align = "center">
<cfform id = "form_id" action="" method="POST" onSubmit = "return verifyMe('<username_textbox_id>','<key>','<form_id>')">
Username:<br>
<br/>
<cfinput type="text" name="uname" id = "uname" />
<br>
<p> </p>
Password:<br/>
<br/>
<cfinput type="password" name="pwd" id="pwd" /><br>
<p> </p>
<cfinput type="submit" name="submit" value="Submit" />
</cfform>
</div>
</body>
</html>