Languages

Menu
Sites
Language
I retrieve google currency graph online.When there is no internet, image shows as Error icon.

Hi,

1.I have developed an application in which I retrieve google currency graph online.When there is no internet, image shows as Error icon.How can i remove this error icon.

2.When i enter amount in the textfield then keyboard appear,after entering the amount, when i click on done button of keyboard nothing happend.Expected is keyboard should be disapper.

Please help me

 

 

thanks and regards

Mohit Kumar

Responses

7 Replies
pius lee

1. Use background image with css, invalid url show blank background. or use onerror event with javascript.

2. I think it's tizen's bug. I have no idea why input tag does not focus out on done key pressed. anyway done is same key with enter so you can take a enter event for blur it.

Refer following code.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
</head>
<style>

</style>
<body>
<img src="badurl" id="badurl" style="width:100px; height:100px;">
<div style="background-image:url(badurl); width:100px; height:100px;"></div>

<input type="text" size="20" id="tinput">

<script>
[].forEach.call(document.getElementsByTagName('img'), function(a){
    a.addEventListener("error", function(ev) {ev.target.src="images/oops.jpg"}, false);
})

document.getElementById("tinput").addEventListener("keypress", function(ev) {
	if (ev.keyCode === 13) ev.target.blur();
}, false);

</script>
</body>
</html>

 

mohit kumar

Hi,

                  I have done with what you said.Again here same problem.When there is no internet connection then it display like below

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="Tizen basic template generated by Tizen Web IDE" />

    <title>Tizen Web IDE - Tizen - Tizen basic Application</title>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <script src="js/main.js"></script>
</head>

<body style="background-color:#808080;" onload="myfunctionn();">


<img src="badurl" id="badurl" style="width:100px; height:100px;">
<div style="background-image:url(badurl); width:100px; height:100px;"></div>

<input type="text" size="20" id="tinput">

<script>
[].forEach.call(document.getElementsByTagName('img'), function(a){
    a.addEventListener("error", function(ev) {ev.target.src="https://www.google.com/finance/getchart?q=USDINR&p=3M&i=86400"}, false);
})

document.getElementById("tinput").addEventListener("keypress", function(ev) {
    if (ev.keyCode === 13) ev.target.blur();
}, false);

</script>

</body>
</html>

                                                                           

pius lee

oh... I would not explain to you enough.

[].forEach.call(document.getElementsByTagName('img'), function(a){
    a.addEventListener("error", function(ev) {ev.target.src="https://www.google.com/finance/getchart?q=USDINR&p=3M&i=86400"}, false);
})

don't do like it.

on error listener, you must set path of image that must be exist.

your code run absolutely correct.

because you set bad path to a src property in img tag. so webkit make error event but you set a image that can't reach.

just set static image in your application to src of image in error listener.

 

mohit kumar

Hi,

I have retrieve google currecncy gaph online.If my device is connected to internet then it show the graph,but if there is no internet then it display "image shows as Error icon".

In my application i can not put static image.

How to check there is an internet connection or not.I want to display popups whaen tehre is no internet connection.

 

Please help me

 

 

 

Thanks and regards

Mohit Kumar

pius lee

I can't understand why you can't put local image to your web application package.

Anyway you can just hide your broken image with css style.

[].forEach.call(document.getElementsByTagName('img'), function(a){
    a.addEventListener("error", function(ev) {ev.target.style.display="none";}, false);
})

 

mohit kumar

Hi,

what is this means

if (ev.keyCode === 13) ev.target.blur();

 

 

please help me

 

Thanks and regards

Mohit Kumar

 

pius lee

keyCode 13 means this key is enter.

ev.target.blur() means "focus out from element on this event"