- 浏览: 30746 次
最新评论
function tipsWindown(title,content,width,height,drag,time,s howbg,cssName) {
$("#windown-box").remove(); //请除内容
var width = width>= 950?this.width=950:this.width=width; //设置最大窗口宽度
var height = height>= 527?this.height=527:this.height=height; //设置最大窗口高度
if(showWindown == true) {
var simpleWindown_html = new String;
simpleWindown_html = "";
simpleWindown_html += "";
simpleWindown_html += "关闭";
simpleWindown_html += "";
simpleWindown_html += "";
$("body").append(simpleWindown_html);
show = false;
}
contentType = content.substring(0,content.indexOf(":"));
content = content.substring(content.indexOf(":")+1,content.l ength);
switch(contentType) {
case "text":
$("#windown-content").html(content);
break;
case "id":
$("#windown-content").html($("#"+content+"").html( ));
break;
case "img":
$("#windown-content").ajaxStart(function() {
$(this).html("");
});
$.ajax({
error:function(){
$("#windown-content").html("加载数据出错...");
},
success:function(html){
$("#windown-content").html("");
}
});
break;
case "url":
var content_array=content.split("?");
$("#windown-content").ajaxStart(function(){
$(this).html("");
});
$.ajax({
type:content_array[0],
url:content_array[1],
data:content_array[2],
error:function(){
$("#windown-content").html("加载数据出错...");
},
success:function(html){
$("#windown-content").html(html);
}
});
break;
case "iframe":
$("#windown-content").ajaxStart(function(){
$(this).html("");
});
$.ajax({
error:function(){
$("#windown-content").html("加载数据出错...");
},
success:function(html){
$("#windown-content").html("");
}
});
}
$("#windown-title h2").html(title);
if(showbg == "true") {$("#windownbg").show();}else {$("#windownbg").remove();};
$("#windownbg").animate({opacity:"0.5"},"normal"); //设置透明度
$("#windown-box").show();
if( height >= 527 ) {
$("#windown-title").css({width:(parseInt(width)+22 )+"px"});
$("#windown-content").css({width:(parseInt(width)+ 17)+"px",height:height+"px"});
}else {
$("#windown-title").css({width:(parseInt(width)+10 )+"px"});
$("#windown-content").css({width:width+"px",height :height+"px"});
}
var cw = document.documentElement.clientWidth,ch = document.documentElement.clientHeight,est = document.documentElement.scrollTop;
var _version = $.browser.version;
if ( _version == 6.0 ) {
$("#windown-box").css({left:"50%",top:(parseInt((c h)/2)+est)+"px",marginTop: -((parseInt(height)+53)/2)+"px",marginLeft:-((pars eInt(width)+32)/2)+"px",zIndex: "999999"});
}else {
$("#windown-box").css({left:"50%",top:"50%",margin Top:-((parseInt(height)+53)/2)+"px",marginLeft:-((p arseInt(width)+32)/2)+"px",zIndex: "999999"});
};
var Drag_ID = document.getElementById("windown-box"),DragHead = document.getElementById("windown-title");
var moveX = 0,moveY = 0,moveTop,moveLeft = 0,moveable = false;
if ( _version == 6.0 ) {
moveTop = est;
}else {
moveTop = 0;
}
var sw = Drag_ID.scrollWidth,sh = Drag_ID.scrollHeight;
DragHead.onmouseover = function(e) {
if(drag == "true"){DragHead.style.cursor = "move";}else{DragHead.style.cursor = "default";}
};
DragHead.onmousedown = function(e) {
if(drag == "true"){moveable = true;}else{moveable = false;}
e = window.event?window.event:e;
var ol = Drag_ID.offsetLeft, ot = Drag_ID.offsetTop-moveTop;
moveX = e.clientX-ol;
moveY = e.clientY-ot;
document.onmousemove = function(e) {
if (moveable) {
e = window.event?window.event:e;
var x = e.clientX - moveX;
var y = e.clientY - moveY;
if ( x > 0 &&( x + sw 0 && (y + sh < ch) ) {
Drag_ID.style.left = x + "px";
Drag_ID.style.top = parseInt(y+moveTop) + "px";
Drag_ID.style.margin = "auto";
}
}
}
document.onmouseup = function () {moveable = false;};
Drag_ID.onselectstart = function(e){return false;}
}
$("#windown-content").attr("class","windown-"+cssN ame);
var closeWindown = function() {
$("#windownbg").remove();
$("#windown-box").fadeOut("slow",function(){$(this ).remove();});
}
if( time == "" || typeof(time) == "undefined") {
$("#windown-close").click(function() {
return;//Eman 封锁了此关闭事件。
$("#windownbg").remove();
$("#windown-box").fadeOut("slow",function(){$(this ).remove();});
});
}else {
setTimeout(closeWindown,time);
}
}
-----------------------tipswindown.js---///////////////////////
因为先前遇到的问题,所以我考虑采用 IFRAME 来隔离不同的脚本,从而实现我需要的效果。
在框架中,我用 JavaScript 获取 JSON 数据,组织成 HTML 代码,最后将其填充至上层文档的一个元素中。按照一般的写法,我们需要用到类似如下的语句: 使用 jQuery ,写法如下: 即指明了是在 window.parent.document 中查找 id=myEle 的元素。
随着前面的问题的解决(其实是对 jQuery 的了解不够),现在两种方案都可以实现我需要的效果了。
另外还有一种实现方式,代码如下: 这种方法要求父文档也要调用 jQuery 。
演示:使用 jQuery 实现 window.parent.document.getElementById().innerHTML
个人感觉 jquery 就是强啦!!!
发表评论
-
javascript特殊运算符
2014-01-02 17:45 557in运算符 -
python中if __name__ == '__main__': 的解析
2014-01-02 17:44 373当你打开一个.py文件时,经常会在代码的最下面看到if __ ... -
matlab字符串
2012-07-06 09:51 610Matlab字符串转换及数值格式转换2010-04-07 ... -
正则表达式
2012-07-06 09:44 618正则表达式的英文是regular expression,意 ... -
正则表达式基础知识
2012-07-06 09:36 730本文内容主要选自 ... -
Flex4的皮肤skin
2012-07-06 09:29 5751.SparkSkin介绍 (1)spark.skin ... -
组件编程
2012-07-03 13:42 590面向过程的编程重 ... -
组件编程
2012-07-03 12:13 506面向过程的编程重 ... -
2012-07-03 09:47 1287<br /><br /> ...
-
重写Flex组件
2012-07-02 10:05 475一、为什么要重写组件 1、在FLEX已有组件无法满足业务 ... -
FLEX学习网站
2012-07-02 10:05 542今天把收藏夹共享 ... -
Flex 学习资源
2012-07-02 10:05 664一、国外站点 1.资源网站 Adobe Lab ... -
Flex style - CSS 的使用
2012-07-02 10:05 558Dan Orlando, 软件架 ... -
2012-07-02 09:41 5...
-
Flex是咋回事之三 谁用谁知道
2012-07-01 09:20 542一项技术,从概念 ... -
Flex 导出文件通用处理
2012-07-01 09:20 735本文 ... -
探究 Flex 组件的生命周期
2012-07-01 09:20 493简介: 最为新一 ... -
Adobe Flex UIComponent LifeCycle
2012-07-01 09:20 482Adobe Flex UIComponent L ... -
重写Flex组件
2012-07-01 09:20 456一、为什么要重写组件 1、在FLEX已有组件无法满足业务 ... -
as3 类库(转),留着以后慢慢看
2012-06-30 11:09 892as3 类库(转),留着以后慢慢看 2011年11月03日 ...
相关推荐
window.parent.document.getElementById(父窗口元素ID); 取父窗口的元素方法: $(selector, window.parent.document); 取父窗口的父窗口的元素就可以用: $(selector, window.parent.parent.document); 类似的,取...
(1)子页面调用父页面的方法或者变量: window.parent.方法()或者变量名 window.parent相当于定位到...window.parent.getElementById("aaa").value; //js的写法 (2)父页面调取子页面 主要是通过contentWindow定位到
} [removed] 修改代码:(在ie和火狐当中均正常) 代码如下: [removed] function oa_tool1(){ window.parent.document.getElementById(“mm”).rows=”20,200,10,*”; } [removed] 原因: 从原则上来讲,修改后的...
在web开发中,经常会用到iframe,难免会碰到需要在父窗口中使用iframe中的元素、或者在iframe框架中使用父窗口的元素 js 在父窗口中获取iframe中的元素 1、 格式:window.frames[“iframe的name值”].document....
比如点击了a.htm上的一个链接而打开了b.htm,然后我们打算在b.htm上输入一个值然后赋予a.htm上的一个id为“name”的textbox中,就可以写为: window.opener.document.getElementById(“name”).value = “输入的数据...
document.getElementById()对象和使用方法
主要是对各浏览器对document.getElementById等方法的实现差异进行了详细的分析介绍,需要的朋友可以过来参考下,希望对大家有所帮助
var div = document.getElementById("div"); for(var i=0; i; i++) { document.body.appendChild(document.createTextNode("Hello, World!")); document.body.appendChild(document.createElement("br"));...
$(“#父窗口元素ID”,window.parent.document)…就行了 js 版本 view sourceprint?1.window.parent.document.getElementById()
innerHTML的使用document.getElementById("id").innerHTML = "contenttext";
jQuery快速开发资料jQuery案例 代码 素材 笔记 作业资料,学习资料 01-getElementById获取元素.html 02-getElementsByTagName获取某些元素.html 03-H5新增获取元素方式(1).html 04-获取特殊元素.html 05-事件三要素....
子页面取父页面中的标签中的值,比如该标签的id为“test”,则: 代码如下: window.parent.document.getElementById(“test”).value; jQuery方法为: $(window.parent.document).contents().find(“test”).val(); ...
主要介绍了浅谈vue中document.getElementById()拿到的是原值的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
72.JS中指定当前打开窗口的父窗口:window.opener,支持opener.opener...的多重继续. 73.JS中的self指的是当前的窗口 74.JS中状态栏显示内容:window.status="内容" 75.JS中的top指的是框架集中最顶层的框架 76.JS中...
ff里不能通过对Frame的ID来直接访问 (IE FF都可以直接通过Frame的Name来访问,但是FrameSet不支持name属性) 因此window.parent.full =》window.parent.document.getElementById(“full”); js操作frame详细解说,...
如:$(document.getElementById("msg"))则为jquery对象,可以使用jquery的方法。 由于jquery对象本身是一个集合。所以如果jquery对象要转换为dom对象则必须取出其中的某一项,一般可通过索引取出。 如:$("#msg")...
} $(function(){ var g = document.getElementById , w = window.testFunc ; //g alert(typeof(g)); alert(String(g)); alert(g instanceof Object); alert(g instanceof Function)...
使用window.onresize let myChart = echarts.init(document.getElementById(dom)) window.onresize = function () { myChat.resize() } 优点:可以根据窗口大小实现自适应 缺点: 多个图表自适应写法比较麻烦...
代码如下: //返回值给父窗体 function returnParent(value) {//获取子窗体返回值 var parent = window.dialogArguments;... //关闭子页面 } //window.opener.document.getElementById(“ActivityPic”);
当初那种直接访问id的方法,逐渐被document.getElementById所替代。如果这年头还在用id访问元素,要么就是做程序里的内嵌网页,要么就是像铁道部那样的超境界仿古网站:) 当然只要保证你的用户都是用ie访问,这样的...