Domain parsing: var distribution problem, domain parsing var Distribution

Source: Internet
Author: User

Domain parsing: var distribution problem, domain parsing var Distribution

In JavaScript, you can declare multiple var statements at any position of the function, and they serve as if they were declared at the top of the function, this behavior is called hoisting (mounting/top resolution/pre-resolution ). When you use a variable and then re-declare it in the function, logical errors may occur. For JavaScript, you only need that your variables are in the same scope (the same function) and they are declared, even when they are used before the var declaration. Let's look at the example below:

// Counterexample myname = "global"; // global variable function func () {alert (myname); // "undefined" var myname = "local"; alert (myname ); // "local"} func ();

In this example, you may think that the first alert is "global" and the second alert is "loacl ". This expectation is understandable, because at the first alert, myname was not declared. At this time, the function will naturally look at the global variable myname. However, this is not actually the case. The first alert will pop up "undefined" because myname is treated as a local variable of the function (although declared later), and all the variable declarations will be mounted to the top of the function. Therefore, to avoid such confusion, it is best to declare all the variables you want to use in advance.

The execution of the above code snippet may be like the following:

Myname = "global"; // global variablefunction func () {var myname; // equivalent to-> var myname = undefined; alert (myname ); // "undefined" myname = "local"; alert (myname); // "local"} func ();



Create a forward region file/var/named/chroot/var/named/linuxcomzone.

Go to the website to find relevant information.
So many
Soft connection and hard connection problems you can find
 
Var map = new googlemapsMap (documentgetElementById ("map_canvas"), myOpt

Because google has officially launched V3 to replace the original V2, you can answer your question with V3.

You can use overlayView, for example:
NameOverlay. prototype = new google. maps. OverlayView (); // extended OverlayView

Function initialize (){
Var mapCenter = new google. maps. LatLng (39.917, 116.397 );
Var mapOptions = {
Zoom: 14,
Center: mapCenter,
MapTypeId: google. maps. MapTypeId. ROADMAP
}
Var map = new google. maps. Map (document. getElementById ("map_canvas"), mapOptions );
// Display the map

Var marker1LatLng = new google. maps. LatLng (39.927, 116.387 );
Var marker1 = new google. maps. Marker ({
Position: marker1LatLng, map: map, title: "Beihai"
});

// Define a NameOverlay, which is displayed at the specified position
Var name1View = new NameOverlay (marker1LatLng, "Beihai", map );

Var marker2LatLng = new google. maps. LatLng (39.937, 116.387 );
Var marker2 = new google. maps. Marker ({
Position: marker2LatLng, map: map, title: "Beijing Normal University"
});

Var name2View = new NameOverlay (marker2LatLng, "Beijing Normal University", map );

}

// NameOverlay Definition
Function NameOverlay (point, name, map ){

// Initialization parameters: coordinates, text, and map
This. point _ = point;
This. name _ = name;
This. map _ = map;

// Create a div only when onAdd is enabled
This. div _ = null;

// Add map
This. setMap (map );
}

NameOverlay. prototype. onAdd = function (){

// Create a div containing the current text
Var div = document. createElement ('div ');
Div. style. borderStyle = "none ";
Div. style. borderWidth = "0px ";
Div. style. position = "absolute ";

Var span = document. c... the remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.