/*
function setfocus(){
if(arguments.length<1)return;
if(arguments[0]==='true')inputelement.focus();
else inputelement.blur();
}
i've used the other solution...
|
Quellcode
|
1
2
3
4
5
6
|
inputelement.addEventListener('touchstart',text_click, false);
function text_click()
{
inputelement.focus();
}
|
/*
krpano - super simple html5 text input plugin
*/
var krpanoplugin = function()
{
var local = this;
var krpano = null;
var plugin = null;
var inputelement = null;
local.registerplugin = function(krpanointerface, pluginpath, pluginobject)
{
krpano = krpanointerface;
plugin = pluginobject;
inputelement = document.createElement("input");
inputelement.type = "text";
inputelement.style.width = "100%";
inputelement.style.height = "100%";
inputelement.style.color = "#535349";
inputelement.style.fontFamily = "Verdana";
inputelement.style.fontSize = "12px";
plugin.registerattribute("text", "", text_set, text_get);
plugin.registerattribute("onchanged", null);
inputelement.addEventListener("change", text_changed, true);
inputelement.addEventListener('touchstart',text_click, false);
plugin.sprite.appendChild(inputelement);
}
local.unloadplugin = function()
{
plugin = null;
krpano = null;
}
function text_set(newtext)
{
inputelement.value = newtext;
}
function text_get()
{
return inputelement.value;
}
function text_changed()
{
krpano.call(plugin.onchanged, plugin);
}
function text_click()
{
inputelement.focus();
}
};
this is code is not working((( focus is not set