Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<input type="button" onclick="opener.document.forms['formName'].elements['elementName'].value = this.form.elements['myOtherField'].value;" />
opener.location = opener.location;
<html>
<head>
<script language="JavaScript" type="text/javascript">
function getValue(){
var win = window.open('subpage.html');
}
//simulate a bit of server process
function simulateServerProcessing(){
var arrSearch = location.search.split("?");
if(arrSearch.length > 1){ // has been submitted
document.getElementById("textoutput").style.display = "block";
document.getElementById("textinput").style.display = "none";
arrValuePairs = arrSearch[1].split("&");
var strTyped = "";
var strSelected = "";
for(var i = 0; i < arrValuePairs.length; i++){
arrCurrent = arrValuePairs[i].split("=");
switch(arrCurrent[0]){
case "textinput1" : {
strTyped = arrCurrent[1];
break;
}
case "hiddenvalue" : {
strSelected = arrCurrent[1];
break;
}
default : {
break;
}
}
}
document.getElementById("textoutput").innerText = "You Typed " +
strTyped +
" and selected " +
strSelected + ".";
}
else{ // is loaded for first time
document.getElementById("textoutput").style.display = "none";
document.getElementById("textinput").style.display = "block";
}
}
</script>
</head>
<body onLoad="simulateServerProcessing();">
<form action="mainpage.html" method="get" id="mainform">
<div id="textinput">
Type Some Text: <input type="text" name="textinput1" value=""/><br/>
<br/>
<input type="button" name="button1" value="Get Value" onClick="getValue()"/>
<input type="hidden" id="hiddenvalue" name="hiddenvalue" value="" />
</div>
<div id="textoutput">
</div>
</form>
</body>
</html>
<html>
<head>
<head>
<script language="JavaScript" type="text/javascript">
function setValue(){
var mummy = window.opener;
var objSelect = document.getElementById("valueselect");
var strValue = objSelect.options[objSelect.selectedIndex].text;
mummy.document.getElementById("hiddenvalue").value = strValue;
mummy.document.getElementById("mainform").submit();
self.close();
}
</script>
</head>
<body>
Select a Value:
<select id="valueselect">
<option>one</option>
<option>two</option>
<option>three</option>
</select><br>
<input type="button" onClick="setValue()" value="OK" />
</body>
</html>