How can I make 2 pages inside a page ? Is that even possible? [closed]
Closed 9 years ago.
- This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
- Questions a开发者_JAVA百科sking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Like 2 "frames" containing their own javascript and forms inside a webpage.
Yes, look up HTML frames, or iframes.
<iframe src="www.google.com" frameborder="0" width="10px" height="10px"></iframe>
<object src="http://www.google.com">
    <em>Google In Page</em>
</object>
or using 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
  }
}
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论