TextBox Popup Color Chooser

[Total: 0    Average: 0/5]

This will create a popup window where the user selects a color.

Body Code:

<form name=f1>
<input type=text name=t1 value="default text">
<br>
<input type=button onclick=doIt() value="click to open other window">
</form>

<script>
var _doc ="";
    _doc ="<html><head><title>Choose Color</title></head>";
	_doc+="<body>";
	_doc+="<a href='javascript:opener.document.f1.t1.style.backgroundColor="red";self.close();'>";
	_doc+="click to make it red</a>";
	_doc+="<BR>";
	_doc+="<a href='javascript:opener.document.f1.t1.style.backgroundColor="green";self.close();'>";
	_doc+="click to make it green</a>";
	_doc+="<BR>";
	_doc+="<a href='javascript:opener.document.f1.t1.style.backgroundColor="blue";self.close();'>";
	_doc+="click to make it blue</a>";
	_doc+="</body></html>";
function doIt()
{
  var _win=window.open();
      _win.document.open();
	  _win.document.write(_doc);
	  _win.document.close();
}
</script>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *