<script>
/****************script动态注入*********************************/
function JSONscriptRequest(fullUrl) {
this.fullUrl = fullUrl;
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
this.headLoc = document.getElementsByTagName("head").item(0);
this.scriptId = 'JscriptId' +
JSONscriptRequest.scriptCounter++;
}
JSONscriptRequest.scriptCounter = 3;
JSONscriptRequest.prototype.buildScriptTag = function () {
this.scriptObj = document.createElement("script");
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("charset", "gbk");
this.scriptObj.setAttribute("src", this.fullUrl +
this.noCacheIE);
this.scriptObj.setAttribute("id", this.scriptId);
}
JSONscriptRequest.prototype.removeScriptTag = function () {
this.headLoc.removeChild(this.scriptObj);
}
JSONscriptRequest.prototype.addScriptTag = function () {
this.headLoc.appendChild(this.scriptObj);
}
</script>
<script>
/***********************调用方法******************************/
function mydo(){
var req = "http://"+IP_PORT+"server?callback=mydodeal&action=getMes&username=username";
bObj = new JSONscriptRequest(req);
bObj.buildScriptTag();
bObj.addScriptTag();
}
/***********************回调函数******************************/
function mydodeal(mytext){
alert(mytext); //回调的定义变量
}
</script>
/****************script动态注入*********************************/
function JSONscriptRequest(fullUrl) {
this.fullUrl = fullUrl;
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
this.headLoc = document.getElementsByTagName("head").item(0);
this.scriptId = 'JscriptId' +
JSONscriptRequest.scriptCounter++;
}
JSONscriptRequest.scriptCounter = 3;
JSONscriptRequest.prototype.buildScriptTag = function () {
this.scriptObj = document.createElement("script");
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("charset", "gbk");
this.scriptObj.setAttribute("src", this.fullUrl +
this.noCacheIE);
this.scriptObj.setAttribute("id", this.scriptId);
}
JSONscriptRequest.prototype.removeScriptTag = function () {
this.headLoc.removeChild(this.scriptObj);
}
JSONscriptRequest.prototype.addScriptTag = function () {
this.headLoc.appendChild(this.scriptObj);
}
</script>
<script>
/***********************调用方法******************************/
function mydo(){
var req = "http://"+IP_PORT+"server?callback=mydodeal&action=getMes&username=username";
bObj = new JSONscriptRequest(req);
bObj.buildScriptTag();
bObj.addScriptTag();
}
/***********************回调函数******************************/
function mydodeal(mytext){
alert(mytext); //回调的定义变量
}
</script>
发表评论
-
js计算出生年龄
2013-06-22 14:56 772<html> <head> ... -
提交数据时,用层覆盖父页面
2011-04-22 13:52 888<script LANGUAGE="J ... -
frame框架
2011-01-18 17:22 811<frameset rows="20% ... -
Ajax 抓页面
2010-12-17 17:37 686引用 <html> <head> ... -
js 打印部分页面
2010-12-14 13:38 1056//打印js function preview() ... -
页面实现打印功能
2010-11-29 15:38 712<html> <head> ... -
那些相见恨晚的 JavaScript 技巧
2010-11-26 14:35 619http://51bcw.com/article-html-3 ... -
自定义 方法
2010-11-04 09:42 620function $(o){return document.g ... -
js 将数字转化为汉字
2010-10-26 09:31 6107<html> <head&g ... -
checkbox只读
2010-08-14 16:37 638<input type="checkbox&q ... -
html中select在js中的操作
2010-08-14 00:11 1257//添加 var Select1= document.getE ... -
js table 行数|js table row|js table td|js 操作Table
2010-08-13 23:39 5338兼容FF,IE的table属性操作, 1,得到表格的行数与 ... -
window.showModalDialog返回多个参数的问题
2010-08-11 23:27 1116a.htm: <SCRIPT language=&quo ... -
web可视化编辑器
2010-08-04 11:14 835web可视化编辑器在线编辑器 http://www.edojs ... -
JS阻止事件冒泡
2010-07-29 10:54 1104<!DOCTYPE html PUBLIC " ... -
iframe解决跨域
2010-07-28 17:48 1215.iframe的使用A域中有parent.html,B域中有c ... -
在InnerHTML中执行js代码(一位教授解决了这个问题)
2010-07-28 17:32 2048<script> /* innerhtml.js ... -
监听父窗口的变化自适应子页面的高度
2010-07-28 17:16 2631<script> /*************** ... -
JS通用库函数
2010-07-28 15:49 19771.ifLetter 判断字符串是否都是 ...
相关推荐
window.name解决跨域问题的文档,刚才网上发现的.也许有点作用
利用动态创建script技术解决静态网站跨域问题.pdf
在本篇文章里小编给各位分享了关于nginx怎么解决跨域问题的方法和实例代码,需要的朋友们参考下。
使用docker部署nginx前后端解决跨域问题
ssm跨域问题解决方案
我使用的是httpClient 进行内部转发 我们在A的服务器上,将前台的文件流,通过httpClient传输到B的服务器上(B的服务器通过控制层接受A传输的文件流,让后保存在B的服务器上。返回一个json结果)
框架完美解决了iframe之间的跨域通讯。底层技术采用window.name转换代理实现
tomcat解决跨域访问问题,具体配置如下: 1、修改tomcat下的Conf/web.xml文件,在该文件内容中新增以下配置,注意,若该web.xml中存在其它filter,则需要将该filter放在所有filter前面; <filter-name>...
1、地址...演示跨域问题以及跨子域名解决方法 2、地址http://a.test.com:8888/testAjaxCross/public/jsonp.do 演示jsonp解决跨域问题的三种方案jsonp、$getJSON、$ajax等
在linux 下安装nginx, 解决网页访问时报跨域问题, 只用改配置文件, 亲测有效
本资源时整合了spring boot来解决跨域问题:包括 1、设置响应参数解决跨域,2、httpClient解决跨域、3、jsonp解决跨域、4、zuul解决跨域 5、nginx解决跨域
解决arcgis server跨域问题: 1、停掉ArcGIS Server的服务。 2、 打开<ArcGIS Server> \framework\runtime\tomcat\conf\web.xml,注册跨域bean 3、lib下拷贝 cors-filter-2.5.jar java-property-utils-1.9.1.jar包 4...
解决tomcat在IP 和端口不同时引起的跨域问题,解决方案,通过编写crossDomain.xml文件
亲证可用,真实有效,压缩包里有使用的具体说明,按照要求,绝对可以解决Tomcat的跨域问题
通过这个插件,可以实现不同域名的双向通信问题,内含demo 配套文章:http://blog.csdn.net/mycwq/article/details/16344171
使用nginx进行服务器管理,经常会遇到跨域问题,此文档就是解决此类问题; nginx跨域问题,解决多端口,多ip问题
### 安装协议解析 跨域处理中间件 koa-body处理post请求数据,也提供了文件上传功能。 @koa/cors解决跨域问题
前端跨域问题解决
解决ajax跨域问题
js 调用 webservice服务,出现的跨域问题,可通过在服务端修改web.config来解决服务端的跨域问题