Hi,
I have a button control as
<asp:Button runat="server" ID="btn" Text="OK" Width="100PX" OnClientClick="return changeMessage();"/>
in aspx page.
In head section of page add a external js file using,
<script language="javascript" type="text/javascript" src="../Script/Map.js"></script>
Map.js content as below,
----------------------------------
function initialize() {
var mapOptions = {
zoom: 6,
center: new google.maps.LatLng(8.558058925477096, 76.87785568237302),
mapTypeId: google.maps.MapTypeId.ROADMAP,
navigationControl: true,
navigationControlOptions:
{
style: google.maps.NavigationControlStyle.ZOOM_PAN
},
scaleControl: true,
DoubleClickZoom: true,
draggable: true,
streetViewControl: true,
draggableCursor: 'pointer'
};
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
map.setZoom(16);
}
function route() {
alert("hai");
}
------------------------------------------------------------------------------
Then, in aspx page i call function 'route()' in Map.js inside a <script> tag as below
--------------------------
<script language="javascript" type="text/javascript">
function changeMessage() {
if (document.getElementById("MainContent_btn").value == "OK") {
document.getElementById("MainContent_messageLabel").innerHTML = "Click START to start drawing route";
document.getElementById("MainContent_routetxt").style.visibility = "hidden";
document.getElementById("MainContent_btn").value = "START";
return false;
}
if (document.getElementById("MainContent_btn").value == "START") {
route();
}
}
</script>
But it give error as ,
Microsoft JScript runtime error: Object expected.
what is wrong in code?..