HTML Data Port

© 2005 Goetz Heller

Table of Contents Description Examples Copyright Note back

The dataPort Object - JavaScript Source Code

/// dport.js

function dataPort(id, target) {

  var bd = document.body;
  var fr = (this.iFrame = document.createElement('iframe'));
//  fr.style.display='none';
  bd.appendChild(this.iFrame);
  var doc = this.iFrame.contentWindow.document;
  doc.open();
  var html = '

inner frame

'; doc.write(html); doc.close(); var frm = doc.createElement('form'); this.form = doc.body.appendChild(frm); frm.method='post'; frm.style.backgroundColor = '#aaaaaa'; if (arguments.length > 0) { frm.id = id; } if (arguments.length > 1) { frm.action = target; } frm.innerHTML = ''; var msg = 'iFrame.contentWindow.document\n=================\nid: '+ frm.id + '\n'; var i = 0; for (var p in fr.contentWindow.document) { msg += ((i++%4==0) ? '\n' : '\t')+p.toString(); } alert(msg); } dataPort.prototype.setTarget = function(target) { this.form.action = target; } function createDP() { var dp = new dataPort('testDp', 'http://www.seidenweich.de/sw_index.php'); } function createDP2() { var dp = new dataPort('testDp2'); dp.setTarget('http://www.seidenweich.de/sw_streetshops.php'); }