Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

javascript

Posted on 2011-09-09
2
Medium Priority
?
269 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 83

Accepted Solution

by:
leakim971 earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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…
Suggested Courses

886 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