0
フィールドの検証時に検証が失敗すると、ポップアップウィンドウが開きます。ポップアップウィンドウを閉じると、最後の要素にフォーカスします(2つ以上のテキストフィールドで複数の検証が失敗した場合)。助言がありますか ? 私のコードは次のとおりです。 - あなたのコード、使用の際にウィンドウがポップアップした最後の要素にフォーカスを設定する方法
function submitformFinal(frm) {
var message;
var inputs = frm.getElementsByTagName("input");
for (var i=0; i < inputs.length; i++)
{
if (inputs[i].getAttribute('type') == 'text')
{
if(!checkSpecialChars(inputs[i].value))
{
message = " Special characters found in element = '";
message += inputs[i].getAttribute('name') + "'\n";
// alert(message);
// createPopup(message);
MyPopUpWin(message);
}
}
}
// return true;
}
function checkSpecialChars(fileOnlyName)
{
if ((/[^a-z0-9\.]/gi).test(fileOnlyName)) {
return false;
}
return true;
}
function MyPopUpWin(message) {
var iMyWidth;
var iMyHeight;
//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (75 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (100 + 50);
//Open the window.
var generator = window.open();
document.onclick=function() {
try{
generator.focus();
return false
}
catch(e){}
}
generator.document.write('<html><head><title>Pop uP</title>');
generator.document.write('<p style="color:#C52B27;">');
generator.document.write(message);
generator.document.write('</p>');
generator.document.write('</head><body>');
generator.document.write('<a href="javascript:self.close()"><img src="/img/save_orange.gif" border=0"> <\/a>');
generator.document.write('</body></html>');
generator.document.close();
}
@Diodeus ......その細かい作業..........私のページ全体が点滅します2番目の.....任意の考えなぜですか? – rcky
ポップアップの前にフォーカスコードを入れてみてください。それはおそらくそれを行うでしょう。 –
@Diodeus ....私がポップアップウィンドウを閉じると、親ページのリンクが動作していない....任意の提案 – rcky