Document.body.focus();
var inID = document.activeElement.id;
function Function1Delay()
{
if(document.activeElement .id != inID)
{
inID = document.activeElement.id;
alert('Start Scan');
document.getElementById(inID).value='Dinesh Sharma';
setTimeout("Func1Dealy()",200);
}
else
{
setTimeout("Func1Delay()",500);
}
}
1.
2.NSString *str12 = [NSString stringWithFormat:@"document.body.focus(); var inii=document.activeElement.id; function Func1Delay() {if(document.activeElement.id != inii){inii=document.activeElement.id; alert('start scan');document.getElementById(inii).value='dinesh sharma';setTimeout(\"Func1Delay()\", 500);} else { setTimeout(\"Func1Delay()\", 500);}}"];
[myWeb stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@" %@ Func1Delay(); ",str12]];
/*
NSString *str1 = [NSString stringWithFormat:@"function showAlert() { alert('%@');}",str];
[myWeb stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"%@ showAlert(); ",str1]];
*/
3.[myWeb stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"var field = document.forms[0].q;" "field.value='something';"]];
//[myWeb stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"var field = document.activeElement; field.value='Dinesh Sharma';"]];
Hey,
ReplyDeleteI'm a web developper, and i'm working on a web app for ipad. The Web app, use a rfid reader, who emulate a keyboard (using ipad camera connector and powered hub usb)
So, in order to make the app nicer, i want to give the focus to an input, when the webpage is load.
That's why i'm interesed by your work. But i'm not sure that your work is what i'm looking for.
Moreover, i never developed ios apps.
Could you confirm me that your work can give focus to an input when the webpage is load ?
And if it is the case, could you please explain me how to use it ?
Thanks for all
Have a nice day