我有这些 CODE#1 脚本,第一个脚本有一个在 Web 服务上运行的源。我需要尝试捕获,因此当 Web 服务访问某个站点时,我可以在 CODE#2 中设置一个 else 条件。我怎样才能做到这一点。谢谢
代码 #1
<script type="text/javascript" language="Javascript" src="http://gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity">
</script>
<script type="text/javascript" language="Javascript">
document.write("<p>Welcome to visitors from "+sGeobytesCity+", " + sGeobytesCountry);
</script>
代码 #2
TRY
{
<script type="text/javascript" language="Javascript" src="http://gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity">
</script>
<script type="text/javascript" language="Javascript">
document.write("<p>Welcome to visitors from "+sGeobytesCity+", " + sGeobytesCountry);
</script>
}
catch
{
window.location = "geobytes.aspx";
}