页面上包含 Jquery ,所以在delphi中定义的js代码是 jquery代码
procedure
TFormLogin.Login();
var
JSFun, newPw: string ;
begin
newPw : = ' <input name=''pw'' id=''pw'' type=''text'' class=''input'' tabindex=''2'' maxlength=''16'' οnkeypress=''if(event.keyCode == 13){login();}'' autocomplete=''off'' value='' ' + edtPwd.Text + ' ''> ' ;
try
// JSFun : = ' login_tab_click(''nexon''); ' ; // 转到左侧
JSFun : = ' login_tab_click(''dnf''); ' ; // 转到右侧
htmlWindow.execScript(JSFun, ' JavaScript ' );
JSFun : = ' $("#id").focus();$("#id").val(" ' + edtUName.Text + ' "); ' ;
htmlWindow.execScript(JSFun, ' JavaScript ' );
JSFun : = ' $("#pw").click();$("#pw").replaceWith(" ' + newPw + ' "); ' ;
htmlWindow.execScript(JSFun, ' JavaScript ' );
JSFun : = ' login(); ' ;
htmlWindow.execScript(JSFun, ' JavaScript ' );
except
end ;
end ;
var
JSFun, newPw: string ;
begin
newPw : = ' <input name=''pw'' id=''pw'' type=''text'' class=''input'' tabindex=''2'' maxlength=''16'' οnkeypress=''if(event.keyCode == 13){login();}'' autocomplete=''off'' value='' ' + edtPwd.Text + ' ''> ' ;
try
// JSFun : = ' login_tab_click(''nexon''); ' ; // 转到左侧
JSFun : = ' login_tab_click(''dnf''); ' ; // 转到右侧
htmlWindow.execScript(JSFun, ' JavaScript ' );
JSFun : = ' $("#id").focus();$("#id").val(" ' + edtUName.Text + ' "); ' ;
htmlWindow.execScript(JSFun, ' JavaScript ' );
JSFun : = ' $("#pw").click();$("#pw").replaceWith(" ' + newPw + ' "); ' ;
htmlWindow.execScript(JSFun, ' JavaScript ' );
JSFun : = ' login(); ' ;
htmlWindow.execScript(JSFun, ' JavaScript ' );
except
end ;
end ;