C
Chi
Hi There,
The following is a popup form that works exactly as I want but I now
need to get the values of each text box added when a user clicks the
'Add' button and pass the values back the opener form into a textarea.
Thanks in advance!
================================
CODE BELOW
================================
<html>
<head>
<script language="javascript">
function AddURL()
{
var theTable = document.getElementById('tblURL');
var URL = document.getElementById('URL').value;
// create a new row object
var newRow = document.createElement("tr");
// create new cell objects
var urlTextCell = document.createElement("td");
var urlEditCell = document.createElement("td");
var previewButtonCell = document.createElement("td");
var deleteButtonCell = document.createElement("td");
// create text field for urlEditCell
var newInput = document.createElement("INPUT");
newInput.type= "text";
newInput.value = URL;
urlEditCell.appendChild(newInput);
// create a preview/test button and add to the previewButtonCell
var newInput = document.createElement("INPUT");
newInput.type= "button";
newInput.value = "Test";
newInput.onclick = new Function("previewURL('"+ URL + "')");
previewButtonCell.appendChild(newInput);
// create delete button and add to the deleteButtonCell
var newInput = document.createElement("INPUT");
newInput.type= "button";
newInput.value = "Delete";
newInput.onclick = DeleteURL;
deleteButtonCell.appendChild(newInput);
// set the text and buttons of each cell
newRow.appendChild(urlTextCell);
newRow.appendChild(urlEditCell);
newRow.appendChild(previewButtonCell);
newRow.appendChild(deleteButtonCell);
// create a new row and replace it with your created row
var tempRow = theTable.insertRow();
tempRow.replaceNode(newRow);
// reset cell and set focus for next entry
document.frmURL.URL.focus();
document.frmURL.URL.value = '';
}
function DeleteURL()
{
// grab the containing row
var theRow = event.srcElement.parentElement.parentElement;
theRow.removeNode(true);
}
function previewURL(theURL)
{
window.showModalDialog(theURL,"","dialogHeight: 500px; dialogWidth:
500px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help:
No; resizable: Yes; status: No;");
}
var validated = false;
function myValidate(mode)
{
if (!mode && !validated) return false;
if (mode)
{
validated=true; formReference.submit();
}
return true;
}
</script>
</head>
<body onLoad="document.frmURL.reset();"></body>
<form action="" name="frmURL" onSubmit="return myValidate(false)">
<fieldset style="padding: 5px; margin-bottom:3px;">
<legend>Alternate Content URL(s)</legend>
<br>
<input id="URL" type="text" size="35"
value="http://www.cnn.com"><input type="button" value="Add"
onclick="AddURL()"/>
<br>
<br>
<table border="0" cellspacing='3' id ="tblURL"></table>
</fieldset>
<div align="right">
<input type="button" value="Save" onClick="">
<input type="button" value="Cancel" onClick="">
</div>
</form>
</body>
</html>
The following is a popup form that works exactly as I want but I now
need to get the values of each text box added when a user clicks the
'Add' button and pass the values back the opener form into a textarea.
Thanks in advance!
================================
CODE BELOW
================================
<html>
<head>
<script language="javascript">
function AddURL()
{
var theTable = document.getElementById('tblURL');
var URL = document.getElementById('URL').value;
// create a new row object
var newRow = document.createElement("tr");
// create new cell objects
var urlTextCell = document.createElement("td");
var urlEditCell = document.createElement("td");
var previewButtonCell = document.createElement("td");
var deleteButtonCell = document.createElement("td");
// create text field for urlEditCell
var newInput = document.createElement("INPUT");
newInput.type= "text";
newInput.value = URL;
urlEditCell.appendChild(newInput);
// create a preview/test button and add to the previewButtonCell
var newInput = document.createElement("INPUT");
newInput.type= "button";
newInput.value = "Test";
newInput.onclick = new Function("previewURL('"+ URL + "')");
previewButtonCell.appendChild(newInput);
// create delete button and add to the deleteButtonCell
var newInput = document.createElement("INPUT");
newInput.type= "button";
newInput.value = "Delete";
newInput.onclick = DeleteURL;
deleteButtonCell.appendChild(newInput);
// set the text and buttons of each cell
newRow.appendChild(urlTextCell);
newRow.appendChild(urlEditCell);
newRow.appendChild(previewButtonCell);
newRow.appendChild(deleteButtonCell);
// create a new row and replace it with your created row
var tempRow = theTable.insertRow();
tempRow.replaceNode(newRow);
// reset cell and set focus for next entry
document.frmURL.URL.focus();
document.frmURL.URL.value = '';
}
function DeleteURL()
{
// grab the containing row
var theRow = event.srcElement.parentElement.parentElement;
theRow.removeNode(true);
}
function previewURL(theURL)
{
window.showModalDialog(theURL,"","dialogHeight: 500px; dialogWidth:
500px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help:
No; resizable: Yes; status: No;");
}
var validated = false;
function myValidate(mode)
{
if (!mode && !validated) return false;
if (mode)
{
validated=true; formReference.submit();
}
return true;
}
</script>
</head>
<body onLoad="document.frmURL.reset();"></body>
<form action="" name="frmURL" onSubmit="return myValidate(false)">
<fieldset style="padding: 5px; margin-bottom:3px;">
<legend>Alternate Content URL(s)</legend>
<br>
<input id="URL" type="text" size="35"
value="http://www.cnn.com"><input type="button" value="Add"
onclick="AddURL()"/>
<br>
<br>
<table border="0" cellspacing='3' id ="tblURL"></table>
</fieldset>
<div align="right">
<input type="button" value="Save" onClick="">
<input type="button" value="Cancel" onClick="">
</div>
</form>
</body>
</html>