首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

iframe中获取file绝对路径有关问题,document.selection.createRange()为空

2012-09-11 
iframe中获取file绝对路径问题,document.selection.createRange()为空var obj document.getElementById(

iframe中获取file绝对路径问题,document.selection.createRange()为空
var obj = document.getElementById("file");
obj.select();
obj.blur();
var path = document.selection.createRange().text;

这段代码放在iframe中时,path获取的路径为空?这是为什么呢?

[解决办法]
WebForm1

HTML code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebForm1.aspx.cs" Inherits="WebForm1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title>WebForm1</title></head><body>    <form id="form1" runat="server">    <div id="divbody">        <iframe src="WebForm2.aspx" id="ifram1" frameborder="0" ></iframe>    </div>    </form></body></html> 

热点排行