javascript:showDialog() 事件方法使用问题.... 问题:通过点击 '提交' 链接,触发 showDialog()事件弹出一个层样式...问题是 我想在 showDialog()方法中第2个参数也就是'文本内容' 中加个弹出新页的超链接....不知道该怎么加...请大侠帮忙!<a href="javascript:showDialog('AA','文本内容',AA)">提交</a> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用一个方法封装下:<a href="javascript:test()">提交</a>function test(){showDialog('AA','<a>文本内容</a>',AA);} 1楼的朋友你这样加上<a>文本内容</a> 不行啊....我的意思是 '文本内容' 这个参数中有一个超链接,例如:<a href="javascript:showDialog('AA','<a href='http://www.baidu.com'>点击我跳到百度</a>',AA)">提交</a>.... 但是我这么加上的话就什么效果都没反映了...请问该怎么加 怎么不对? showDialog('AA','<a>文本内容</a>',AA); 这个方法是你自己的,第二个参数具体实现要支持链接。 放html里<a href="javascript:test()">提交</a>放脚本里function test(){showDialog('AA','<a href="http://www.baidu.com">点击我跳到百度</a>',AA);//注意引号,注意第三个变量,AA应该提示未定义。。} function showDialog(title,message,type,autohide) { if(!type) { type = 'error'; } var dialog; var dialogheader; var dialogclose; var dialogtitle; var dialogcontent; var dialogmask; if(!document.getElementById('dialog')) { dialog = document.createElement('div'); dialog.id = 'dialog'; dialogheader = document.createElement('div'); dialogheader.id = 'dialog-header'; dialogtitle = document.createElement('div'); dialogtitle.id = 'dialog-title'; dialogclose = document.createElement('div'); dialogclose.id = 'dialog-close' dialogcontent = document.createElement('div'); dialogcontent.id = 'dialog-content'; dialogmask = document.createElement('div'); dialogmask.id = 'dialog-mask'; document.body.appendChild(dialogmask); document.body.appendChild(dialog); dialog.appendChild(dialogheader); dialogheader.appendChild(dialogtitle); dialogheader.appendChild(dialogclose); dialog.appendChild(dialogcontent);; dialogclose.setAttribute('onclick','hideDialog()'); dialogclose.onclick = hideDialog; } else { dialog = document.getElementById('dialog'); dialogheader = document.getElementById('dialog-header'); dialogtitle = document.getElementById('dialog-title'); dialogclose = document.getElementById('dialog-close'); dialogcontent = document.getElementById('dialog-content'); dialogmask = document.getElementById('dialog-mask'); dialogmask.style.visibility = "visible"; dialog.style.visibility = "visible"; } dialog.style.opacity = .00; dialog.style.filter = 'alpha(opacity=0)'; dialog.alpha = 0; var width = pageWidth(); var height = pageHeight(); var left = leftPosition(); var top = topPosition(); var dialogwidth = dialog.offsetWidth; var dialogheight = dialog.offsetHeight; var topposition = top + (height / 3) - (dialogheight / 2); var leftposition = left + (width / 2) - (dialogwidth / 2); dialog.style.top = topposition + "px"; dialog.style.left = leftposition + "px"; dialogheader.className = type + "header"; dialogtitle.innerHTML = title; dialogcontent.className = type; dialogcontent.innerHTML = message; var content = document.getElementById(WRAPPER); dialogmask.style.height = content.offsetHeight + 'px'; dialog.timer = setInterval("fadeDialog(1)", TIMER); if(autohide) { dialogclose.style.visibility = "hidden"; window.setTimeout("hideDialog()", (autohide * 1000)); } else { dialogclose.style.visibility = "visible"; }}这是我js 能帮我看看吗 function showDialog(title,message,type,autohide) { if(!type) { type = 'error'; } var dialog; var dialogheader; var dialogclose; var dialogtitle; var dialogcontent; var dialogmask; if(!document.getElementById('dialog')) { dialog = document.createElement('div'); dialog.id = 'dialog'; dialogheader = document.createElement('div'); dialogheader.id = 'dialog-header'; dialogtitle = document.createElement('div'); dialogtitle.id = 'dialog-title'; dialogclose = document.createElement('div'); dialogclose.id = 'dialog-close' dialogcontent = document.createElement('div'); dialogcontent.id = 'dialog-content'; dialogmask = document.createElement('div'); dialogmask.id = 'dialog-mask'; document.body.appendChild(dialogmask); document.body.appendChild(dialog); dialog.appendChild(dialogheader); dialogheader.appendChild(dialogtitle); dialogheader.appendChild(dialogclose); dialog.appendChild(dialogcontent);; //dialogclose.setAttribute('onclick','hideDialog()'); //dialogclose.onclick = hideDialog; } else { dialog = document.getElementById('dialog'); dialogheader = document.getElementById('dialog-header'); dialogtitle = document.getElementById('dialog-title'); dialogclose = document.getElementById('dialog-close'); dialogcontent = document.getElementById('dialog-content'); dialogmask = document.getElementById('dialog-mask'); dialogmask.style.visibility = "visible"; dialog.style.visibility = "visible"; } //dialog.style.opacity = .00; //dialog.style.filter = 'alpha(opacity=0)'; dialog.alpha = 0; var width = 500; var height = 500; var left = 50; var top = 50; var dialogwidth = dialog.offsetWidth; var dialogheight = dialog.offsetHeight; var topposition = top + (height / 3) - (dialogheight / 2); var leftposition = left + (width / 2) - (dialogwidth / 2); dialog.style.top = topposition + "px"; dialog.style.left = leftposition + "px"; dialogheader.className = type + "header"; dialogtitle.innerHTML = title; dialogcontent.className = type; dialogcontent.innerHTML = message; //var content = document.getElementById(WRAPPER); //dialogmask.style.height = content.offsetHeight + 'px'; //dialog.timer = setInterval("fadeDialog(1)", 100); if(autohide) { dialogclose.style.visibility = "hidden"; //window.setTimeout("hideDialog()", (autohide * 1000)); } else { dialogclose.style.visibility = "visible"; }}showDialog('AA','<a href="http://www.baidu.com">baidu</a>','AA');楼主,我模拟了下,注释掉了一些内容,然后就可以添加链接了,是不是楼主注释掉部分的问题,我感觉这个跟能不能在message里增加链接<a>标签无关,我是新手,楼主可以参考下 一个很奇怪的问题 有一个时间戳,如何得到它的日期 有关JavaScript代码规范的问题...... javascript有什么判断空值的好方法 有没有办法实现从表单1中获取checkbox的数据,并从表单2中进行提交? ●2个script,在2003sp1上运行总是提示“未指明的错误”,请高手帮我解决!在线等!谢谢! 弹出窗口,在窗口打开时,不允许再次打开. "ForReading" 未定义的错误? 验证身份证的正则表达式如何写(15位或18位) 框架问题:为什么不行???? 遇到问题了? javascript怎么捕获文本框的粘贴事件
{
showDialog('AA','<a>文本内容</a>',AA);
}
怎么不对? showDialog('AA','<a>文本内容</a>',AA); 这个方法是你自己的,第二个参数具体实现要支持链接。
放html里
<a href="javascript:test()">提交</a>
放脚本里
function test()
{
showDialog('AA','<a href="http://www.baidu.com">点击我跳到百度</a>',AA);//注意引号,注意第三个变量,AA应该提示未定义。。
}
function showDialog(title,message,type,autohide) {
if(!type) {
type = 'error';
}
var dialog;
var dialogheader;
var dialogclose;
var dialogtitle;
var dialogcontent;
var dialogmask;
if(!document.getElementById('dialog')) {
dialog = document.createElement('div');
dialog.id = 'dialog';
dialogheader = document.createElement('div');
dialogheader.id = 'dialog-header';
dialogtitle = document.createElement('div');
dialogtitle.id = 'dialog-title';
dialogclose = document.createElement('div');
dialogclose.id = 'dialog-close'
dialogcontent = document.createElement('div');
dialogcontent.id = 'dialog-content';
dialogmask = document.createElement('div');
dialogmask.id = 'dialog-mask';
document.body.appendChild(dialogmask);
document.body.appendChild(dialog);
dialog.appendChild(dialogheader);
dialogheader.appendChild(dialogtitle);
dialogheader.appendChild(dialogclose);
dialog.appendChild(dialogcontent);;
dialogclose.setAttribute('onclick','hideDialog()');
dialogclose.onclick = hideDialog;
} else {
dialog = document.getElementById('dialog');
dialogheader = document.getElementById('dialog-header');
dialogtitle = document.getElementById('dialog-title');
dialogclose = document.getElementById('dialog-close');
dialogcontent = document.getElementById('dialog-content');
dialogmask = document.getElementById('dialog-mask');
dialogmask.style.visibility = "visible";
dialog.style.visibility = "visible";
}
dialog.style.opacity = .00;
dialog.style.filter = 'alpha(opacity=0)';
dialog.alpha = 0;
var width = pageWidth();
var height = pageHeight();
var left = leftPosition();
var top = topPosition();
var dialogwidth = dialog.offsetWidth;
var dialogheight = dialog.offsetHeight;
var topposition = top + (height / 3) - (dialogheight / 2);
var leftposition = left + (width / 2) - (dialogwidth / 2);
dialog.style.top = topposition + "px";
dialog.style.left = leftposition + "px";
dialogheader.className = type + "header";
dialogtitle.innerHTML = title;
dialogcontent.className = type;
dialogcontent.innerHTML = message;
var content = document.getElementById(WRAPPER);
dialogmask.style.height = content.offsetHeight + 'px';
dialog.timer = setInterval("fadeDialog(1)", TIMER);
if(autohide) {
dialogclose.style.visibility = "hidden";
window.setTimeout("hideDialog()", (autohide * 1000));
} else {
dialogclose.style.visibility = "visible";
}
}这是我js 能帮我看看吗
function showDialog(title,message,type,autohide) {
if(!type) {
type = 'error';
}
var dialog;
var dialogheader;
var dialogclose;
var dialogtitle;
var dialogcontent;
var dialogmask;
if(!document.getElementById('dialog')) {
dialog = document.createElement('div');
dialog.id = 'dialog';
dialogheader = document.createElement('div');
dialogheader.id = 'dialog-header';
dialogtitle = document.createElement('div');
dialogtitle.id = 'dialog-title';
dialogclose = document.createElement('div');
dialogclose.id = 'dialog-close'
dialogcontent = document.createElement('div');
dialogcontent.id = 'dialog-content';
dialogmask = document.createElement('div');
dialogmask.id = 'dialog-mask';
document.body.appendChild(dialogmask);
document.body.appendChild(dialog);
dialog.appendChild(dialogheader);
dialogheader.appendChild(dialogtitle);
dialogheader.appendChild(dialogclose);
dialog.appendChild(dialogcontent);;
//dialogclose.setAttribute('onclick','hideDialog()');
//dialogclose.onclick = hideDialog;
} else {
dialog = document.getElementById('dialog');
dialogheader = document.getElementById('dialog-header');
dialogtitle = document.getElementById('dialog-title');
dialogclose = document.getElementById('dialog-close');
dialogcontent = document.getElementById('dialog-content');
dialogmask = document.getElementById('dialog-mask');
dialogmask.style.visibility = "visible";
dialog.style.visibility = "visible";
}
//dialog.style.opacity = .00;
//dialog.style.filter = 'alpha(opacity=0)';
dialog.alpha = 0;
var width = 500;
var height = 500;
var left = 50;
var top = 50;
var dialogwidth = dialog.offsetWidth;
var dialogheight = dialog.offsetHeight;
var topposition = top + (height / 3) - (dialogheight / 2);
var leftposition = left + (width / 2) - (dialogwidth / 2);
dialog.style.top = topposition + "px";
dialog.style.left = leftposition + "px";
dialogheader.className = type + "header";
dialogtitle.innerHTML = title;
dialogcontent.className = type;
dialogcontent.innerHTML = message;
//var content = document.getElementById(WRAPPER);
//dialogmask.style.height = content.offsetHeight + 'px';
//dialog.timer = setInterval("fadeDialog(1)", 100);
if(autohide) {
dialogclose.style.visibility = "hidden";
//window.setTimeout("hideDialog()", (autohide * 1000));
} else {
dialogclose.style.visibility = "visible";
}
}
showDialog('AA','<a href="http://www.baidu.com">baidu</a>','AA');楼主,我模拟了下,注释掉了一些内容,然后就可以添加链接了,是不是楼主注释掉部分的问题,我感觉这个跟能不能在message里增加链接<a>标签无关,我是新手,楼主可以参考下