popup demo
Django下实现:
urls.py:
from django.conf.urls import url
from django.contrib import admin
from app01 import views urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^index/', views.index),
url(r'^pop/', views.pop),
]
app01.views.py
from django.shortcuts import render def index(request):
return render(request,'index.html') def pop(request):
if request.method == "GET":
return render(request, 'pop.html')
else:
user = request.POST.get('user') #这里可以有数据库操作
return render(request,'pop_response.html',{'user':user})
templates.index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1 id="i1">无所谓</h1>
<a href="#" onclick="popUp('http://www.oldboyedu.com')">点我点我</a> <script>
function xxxpopupCallback(text) {
document.getElementById('i1').innerHTML = text;
}
function popUp(url) {
window.open( '/pop/', '/pop/' ,"status=1, height:500, width:600, toolbar=0, resizeable=0");
} </script>
</body>
</html>
templates.pop.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form method="post">
{% csrf_token %}
<input type="text" name="user">
<input type="submit" value="保存">
</form>
</body>
</html>
templates.pop_response.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>正在关闭</h1>
<script>
(function () {
// 可以调用popup原页面的一个函数
opener.xxxpopupCallback("{{ user }}");
window.close();
})() </script>
</body>
</html>
popup demo的更多相关文章
- Javascript快速入门(下篇)
		
Javascript, cheer up. Ajax:其通过在Web页面与服务器之间建立一个额外的处理层,这个处理层就被称为Ajax引擎,它解释来自用户的请求,在后台以异步的方式处理服务器通信,其结构 ...
 - 40个新鲜的 jQuery 插件,使您的网站用户友好
		
作为最流行的 JavaScript 开发框架,jQuery 在现在的 Web 开发项目中扮演着重要角色,它简化了 HTML 文档遍历,事件处理,动画以及 Ajax 交互,这篇文章特别收集了40个新鲜的 ...
 - Zybo GPIO Demo Run Embedded Linux
		
1.Environment Ubuntu 12.04 x86_64 Vivado 2013.4 SDK 2013.4 2.Pre-requisites 2.1 CodeSourcery arm-g ...
 - 课时9—popup
		
内容比较多的时候可以全屏显示,用第一种实现方式,如图1 图1 内容较少的话可以使用第二种实现方式如图2:图2 具体的实现代码如下: .header,.footer,.wrap-page{ positi ...
 - AngularJs的UI组件ui-Bootstrap分享(四)——Datepicker Popup
		
Datepicker Popup是用来选择日期的控件,一般和文本框一起使用,功能和Jquery的插件My97DatePicker一样.在Datepicker Popup内部使用了ui-bootstra ...
 - 重新想象 Windows 8.1 Store Apps (78) - 控件增强: ScrollViewer, FlipView, Popup
		
[源码下载] 重新想象 Windows 8.1 Store Apps (78) - 控件增强: ScrollViewer, FlipView, Popup 作者:webabcd 介绍重新想象 Wind ...
 - [转]jQuery Popup Login and Contact Form
		
本文转自:http://www.formget.com/jquery-popup-form/ Pop up forms are the smart way to present your site. ...
 - Pass value from child popup window to parent page window using JavaScript--reference
		
Here Mudassar Ahmed Khan has explained how to pass value from child popup window to parent page wind ...
 - jquerymobile知识点三:弹出层popup
		
弹出层popup很简单,主要就是弹出验证,登陆注册,提交信息之类的,下面是我写好的一个demo... <div data-role="popup" id="popu ...
 
随机推荐
- DIJ的优化,和spfa的优化
			
SPFA和DIJ求最短路的算法的坑点一直是很多的.经常会让人搞不懂. 易错案例: 用重载运算符来排序,如: struct cmp { bool operator ()(int x, int y) co ...
 - [luogu 4719][模板]动态dp
			
传送门 Solution \(f_{i,0}\) 表示以i节点为根的子树内,不选i号节点的最大独立集 \(f_{i,1}\)表示以i节点为根的子树内,选i号节点的最大独立集 \(g_{i,0}\) 表 ...
 - Shell编程—企业生产案例
			
Linux系统Shell编程—企业生产案例(一) 企业数据库可以说是重点保护对象啊,没有之一,数据在当今企业里就是生命线,因此今天就来说一说,如何通过shell脚本来检查或监控MYSQL数据库服务是否 ...
 - 关于SQL中的ROWNUM问题
			
前言 昨天改小程序的后台,看见之前写的分页很奇怪,startIndex和endIndex两个下标, endIndex 总是在里面层,而startIndex总是在外层,我随后改了,直接Where row ...
 - vue项目用户登录状态管理,vuex+localStorage实现
			
安装vuex cnpm install vuex --save-dev
 - oracle清理归档日志(缓存)
			
1.用RMAN连接目标DB: rman target / RMAN target sys/*****@orcl 2.在RMAN命令窗口中,输入如下命令(清理所有的归档日志): crosscheck a ...
 - MySQL枚举类型enum字段在插入不在指定范围的值时, 是否是"插入了enum的第一个值"?
			
刚刚在看<<深入浅出MySQL>>一书的"ENUM类型"一节, 以下面的代码举例, 得出结论: "还可以看出对于不在ENUM指定范围内的值时, 并 ...
 - HearthBuddy的class276以及class247
			
使用de4dot-cex反编译原版的hearthbuddy得到的 链接: https://pan.baidu.com/s/1hT79LpIjbyvODsjnkSe_5A 提取码: iemx class ...
 - 高通平台打开 dynamic debug方法【学习笔记】
			
一.首先在内核的配置文件添加如下的配置: CONFIG_DEBUG_FS=y CONFIG_DYNAMIC_DEBUG=y 二.找到自己平台对应的 device/qcom/xxxx/init.targ ...
 - PCA  python 实现
			
PCA 实现: 参考博客:https://blog.csdn.net/u013719780/article/details/78352262 from __future__ import print_ ...