Solved

javascript

Posted on 2011-09-09
2
263 Views
Last Modified: 2012-05-12
I have the following java-script codes. it is working fine with alert msg.
I would like to stop alert msg and show the msg on the webpage
like
<body>
<span>something wrong</span>
</body>

Is that possible? Please show me how to do it. Thanks


function handleErrors() {
        if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
            alert("Error code: " + gdir.getStatus().code);
        else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
            alert("Error code: " + gdir.getStatus().code);
        else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
            alert("Error code: " + gdir.getStatus().code);
        else if (gdir.getStatus().code == G_GEO_BAD_KEY)
            alert("Error code: " + gdir.getStatus().code);
        else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
            alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
        else alert("An unknown error occurred.");

    }
0
Comment
Question by:Webboy2008
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36514317
<span id="span_ID" >something wrong</span>

function handleErrors() {
        if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS || gdir.getStatus().code == G_GEO_SERVER_ERROR || gdir.getStatus().code == G_GEO_MISSING_QUERY || gdir.getStatus().code == G_GEO_BAD_KEY)
        {
            document.getElementById("span_ID").innerHTML = "Error code: " + gdir.getStatus().code;
        }
        else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
        {
            document.getElementById("span_ID").innerHTML = "A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code;
        }
        else
        {
            document.getElementById("span_ID").innerHTML = "An unknown error occurred.";
        }
}

Open in new window

0
 

Author Comment

by:Webboy2008
ID: 36514433
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_27300973.html

Thanks, I have another easy question and see you have time for helps.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ModalPopup  question 22 38
Jquery driving me nuts... 14 27
Multi-Column Repeater 3 23
close pop up windows when logout or main window closes 17 44
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question