How to pass the parameters from one html page to another
Your fields need to have name
attributes to pass values as the id
will not do this.
The javascript DOM element selectors (document.getElementById('ManagerId').value
, etc.) in index.js are looking for elements on page 2 that don't appear to exist. You'll have to do a little more to actually pull the the parameters from the URL using window.location.search()
. See: How to obtain the query string from the current URL with JavaScript?
Open new HTML page via javascript and pass parameters
Your sending the entire object to the page, while you should send just its value.
Use this code to get the value of an input :
var value = document.getElementById("input").value;
Then, it's really simple to redirect to other page sending data via URL. You just need to redirect adding a parameter like this :
window.location.href = "searchresult.html?city="+value;
How to pass parameters from script to html form value
You should change showPosition to this:
<script>
function showPosition(position) {
let hData = returnH(position);
let wData = returnW(position);
x.innerHTML = "Latitude: " + hData +
"<br>Longitude: " + wData;
mapboxgl.accessToken = 'My Token';
var map = new mapboxgl.Map({
container: 'map', // container id
style: 'mapbox://styles/mapbox/streets-v11', // style URL
center: [position.coords.longitude, position.coords.latitude], // starting position [lng, lat]
zoom: 18 // starting zoom
});
document.querySelector("#hValue").value = hData;
document.querySelector("#wValue").value = wData;
}
function returnH(position) {
return position.coords.latitude;
}
function returnW(position) {
return position.coords.longitude;
}
</script>
and also change form to this:
<form action=".." method="POST">
<input type="hidden" id="hValue" />
<input type="hidden" id="wValue" />
</form>
How to pass variables into an HTML body
The HTML must be a string (text), and you need to build the HTML with a text formula. Text strings in JavaScript are put together, (concatenated) with a plus sign:
var tableHTML = '<table style="width:100%">' + //Note single quotes on ends
"<tr><td>Calories</td><td>" +
calories +
"</td></tr>" +
"<tr><td>Calories From Fat</td><td>" +
caloriesFromFat +
"</td></tr>" +
"<tr><td>PolyUnsaturated</td><td>" +
polyFat +
"</td></tr>" +
"</table>";
If double quotes are used in the HTML attribute, then use single quotes on the ends of the string.
Then just use the variable name for the email HTML:
htmlBody: tableHTML
Related Topics
How to Make a Chevron Arrow Using CSS
How to Resize an Image to Fit in the Browser Window
Add Hyperlink to Textblock Wpf
I Can't Get My Font-Awesome Icons to Show Up. Tried Importing CSS with Multiple Methods
How to Center the Contents of an HTML Table
Linking to CSS in an Svg Embedded by an Img Tag
Why Is There Space Between Line Boxes, Not Due to Half Leading
Do I Need a "/" at the End of an <Img> or <Br> Tag, etc.
How to Get the Collection of Model State Errors in ASP.NET MVC
100% Width Twitter Bootstrap 3 Template
Flexbox: Wrong Width Calculation When Flex-Direction: Column, Flex-Wrap: Wrap