如何在页面内制作2页?这甚至可能吗?

时间:2011-09-29 23:43:02

标签: javascript html forms frames

就像2个“框架”一样,在网页中包含自己的javascript和表单。

2 个答案:

答案 0 :(得分:5)

是的,查找HTML框架或iframe。

答案 1 :(得分:0)

<iframe src="www.google.com" frameborder="0" width="10px" height="10px"></iframe>

<object src="http://www.google.com">
    <em>Google In Page</em>
</object>

或使用File API:

function startRead() {  
  // obtain input element through DOM 

  var file = document.getElementById('file').files[0];
  if(file){
    getAsText(file);
  }
}

function getAsText(readFile) {

  var reader = new FileReader();

  // Read file into memory as UTF-16      
  reader.readAsText(readFile, "UTF-16");

  // Handle progress, success, and errors
  reader.onprogress = updateProgress;
  reader.onload = loaded;
  reader.onerror = errorHandler;
}

function updateProgress(evt) {
  if (evt.lengthComputable) {
    // evt.loaded and evt.total are ProgressEvent properties
    var loaded = (evt.loaded / evt.total);
    if (loaded < 1) {
      // Increase the prog bar length
      // style.width = (loaded * 200) + "px";
    }
  }
}

function loaded(evt) {  
  // Obtain the read file data    
  var fileString = evt.target.result;
  // Handle UTF-16 file dump
  if(utils.regexp.isChinese(fileString)) {
    //Chinese Characters + Name validation
  }
  else {
    // run other charset test
  }
  // xhr.send(fileString)     
}

function errorHandler(evt) {
  if(evt.target.error.code == evt.target.error.NOT_READABLE_ERR) {
    // The file could not be read
  }
}