Ecco il mio codice HTML (lo so, è scritto da un novellino):
codice:
<html>
<head>
<title>Mostra indicazioni</title>
<style>
html, body
{
height: 100%;
margin: 0;
padding: 0;
}
#map
{
height: 100%;
float: left;
width: 70%;
height: 100%;
}
</style>
<script type="text/javascript">
function getValue(varname)
{
// First, we load the URL into a variable
var url = window.location.href;
// Next, split the url by the ?
var qparts = url.split("?");
// Check that there is a querystring, return "" if not
if (qparts.length == 0)
{
return "";
}
// Then find the querystring, everything after the ?
var query = qparts[1];
// Split the query string into variables (separates by &s)
var vars = query.split("&");
// Initialize the value with "" as default
var value = "";
// Iterate through vars, checking each one for varname
for (i=0;i<vars.length;i++)
{
// Split the variable by =, which splits name and value
var parts = vars[i].split("=");
// Check if the correct variable
if (parts[0] == varname)
{
// Load value into variable
value = parts[1];
// End the loop
break;
}
}
// Convert escape code
value = decodeURIComponent(value);
// Convert "+"s to " "s
var replaced = value.split('+').join(' ');
// Return the value
return replaced;
}
</script>
</head>
<body>
<!-- spaces in page -->
<div id="id01">
</div>
<div id="map"></div>
<h1>Hello,
<script type="text/javascript">
var name = getValue("start_loc");
var name2 = getValue("end_loc");
document.write(name);
document.write(name2);
</script>
</h1>
<script type='text/javascript' src="init_map.js">
</script>
<script src="https://maps.googleapis.com/maps/api/js"
async defer></script>
</body>
</html>
c'è qualcosa che ti sembra strano?