I am working on a project which works perfectly in devices with higher version-I have checked it in 4.1.2 version.
The problem is that it is not working in devices with android version 2.2.1 and 2.3.5.
I have six images to which I have added functionalities. The functionality for 2 images is to call a different HTML page with the id value. The functionality for the other four images is also the same,BUT the images will display based on the database value.
The functionality for 2 images is to call a different HTML page with the id value.
This is how I have coded..
<div id="header " class="header ">
<div id="header_title" class="header_title"> </div>
<div id="abc" class="abc"><img src="img/abc.png" onClick="abc()"/></div>
-----so -on
I have declared the abc function as
function abc(){
window.location.href="index.html";
}
The functionality for the other four images is also the same,BUT the images will display based on the database value.
if(value_in_db==0) {
document.getElementById("xyz").innerHTML = '<img src="img/inactive.png" />'
} else {
document.getElementById("xyz").innerHTML = '<img src="img/active.png" onclick="xyz()"/> '
}
I have declared the xyz function as
function xyz(){
window.location.href="basic.html";
}
Problem Facing:
The onclick functionality functions once in a while in android version 2.2.1 and 2.3.5.when keep on trying to click suddenly the function is called. I have tried fixing this error for almost 2 days.
I had faced a similar problem with the CSS position:fixed. This was not supported in the lower versions of android.I was suggested with a solution here.
I have tried with this addEventListener function it did not work for me.
I hope I get a solution for this problem to.
Please help me to fix this and guide me!
EDIT :1 touchevent and deviceready
document.addEventListener("deviceready", onDeviceReady, false);
document.addEventListener( "touchstart", function(e){ onStart(e); }, false );
function onStart ( touchEvent )
{
if( navigator.userAgent.match(/Android/i) )
{
touchEvent.preventDefault();
}
}
This works in the higher end version but not in the lower end version. I know its baseless to mention 2 document.addEventListener
..as it worked in the higher versions.i continued it.