asp弹出窗口和返回值 [英] asp popup window and return value

查看:90
本文介绍了asp弹出窗口和返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好专家,

急需你的指导!

代码为ASP文本框和按钮:

hello experts,
need your guidance its urgent!
code for ASP textbox and button:

<INPUT id="txtSchX" NAME="txtSchX" size="72">
<Input type="button"  value="..." onmouseover="window.status ='Show School Name';return true;" onmouseout="window.status='';return true;" Onclick="javascript:show_School();">





和javascript中的代码:



and code in javascript:

function show_School()
{
    var myWindow;
    myWindow = window.open("","SchoolName","width=265,height=210,status=no,resizable=no,top=200,left=600");
    myWindow.document.write("<html>");
    myWindow.document.write("<head><title>School Name</title>");
    myWindow.document.write("</head>");
    myWindow.document.write("<body>" );
    myWindow.document.write("<table>");
    myWindow.document.write("<tr><td><a href='#' onClick='wondow.close();'></a>Manish Kumar</td></tr>");
}



当我点击按钮打开弹出的链接(Manish Kumar)时,它工作正常,

和当我点击链接时它会关闭这个弹出窗口..



专家,其实我想要的是,如果我点击链接,它会将我的名字打印到文本框中。

请指导我怎么办????

急需


it works fine when i click on button it open a pop up with a link (Manish Kumar),
and when i click on the link it close this popup..

Experts, actually i want that if i click on the link it will print my name into the textbox.
please guide me how can i do so????
urgent needed

推荐答案

你好,



这是一个小html来演示它是如何完成的。

Hello,

Here is a small html to demonstrate how it can be done.
<html>
<head>
<title>JS Popup</title>
<script type="text/javascript">
function show_School() {
    var myWindow;
    myWindow = window.open("", "SchoolName", "width=265,height=210,status=no,resizable=no,top=200,left=600");
    myWindow.document.write("<html>");
    myWindow.document.write("<head><title>School Name</title>");
    myWindow.document.write("<" + "script" + ">");
    myWindow.document.write("function sendName(arg) {var hWin=window.opener;if(hWin)hWin.printName(arg);window.close();}");
    myWindow.document.write("<" + "/script" + ">");
    myWindow.document.write("</head>");
    myWindow.document.write("<body>" );
    myWindow.document.write("<table>");
    myWindow.document.write("<tr><td><a href=\"#\" onClick=\"sendName('Manish Kumar');\">Manish Kumar</a></td></tr>");
}

function printName(args) {
    var txt = document.getElementById('txtSchX');
	txt.value = args;
}
</script>
</head>
<form id="frmMain" name="frmMain">
    <input type="text" id="txtSchX" NAME="txtSchX" size="72">
    <Input type="button"  value="..." Onclick="show_School();">
</form>
</html>



问候,


Regards,


<script language="javascript">
// Manish's Code for get School Name on 24-Apr-2013 Starts Here

var vDay = ["","CARMEL JUNIOR COLLEGE, SONARI","DAV PUBLIC SCHOOL, BISTUPUR", "DAV PUBLIC SCHOOL, NIT","DBMS ENGLISH SCHOOL, KADMA",
 "HILL TOP SCHOOL, TELCO","JAMSHEDPUR PUBLIC SCHOOL, BARIDIH","KERALA PUBLIC SCHOOL, KADMA","KERALA SAMAJAM MODEL SCHOOL, SAKCHI",
 "LITTLE FLOWER SCHOOL, TELCO","LOYALA SCHOOL, JAMSHEDPUR","MOTILAL NEHRU PUBLIC SCHOOL, SAKCHI","MRS K M P M INTER COLLEGE, JAMSHEDPUR",
 "NARBHERAM HANSRAJ ENGLISH SCHOOL, BISTUPUR","RAJENDRA VIDYALAYA, SAKCHI","SACRED HEART CONVENT SCHOOL, JAMSHEDPUR",
 "ST MARYS ENGLISH HIGH SCHOOL, BISTUPUR","VIDYA BHARTI CHINMAYA VIDYALAYA, TELCO","VIVEK VIDYALAYA, CHHOTA GOVINDPUR"];

var fontface = "Verdana";
var fontsize = 2;
var ggWinCal;
isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;

function SchoolName(p_item, p_WinCal) {
    //alert(p_item);
    if (p_WinCal == null)
        this.gWinCal = ggWinCal;
    else
        this.gWinCal = p_WinCal;

    this.gReturnItem = p_item;
}

SchoolName.prototype.getMonthlySchoolNameCode = function() {
    var vCode = "";
    var vHeader_Code = "";
    var vData_Code = "";
    vData_Code = this.cal_data();
    vCode = vCode + vHeader_Code + vData_Code;
    vCode = vCode + "</TABLE>";
    return vCode;
}

SchoolName.prototype.show = function() {
    var vCode = "";

    this.gWinCal.document.open();
    this.wwrite("<html>");
    this.wwrite("<head><title>School Name</title>");
    this.wwrite("</head>");

    this.wwrite("<body>");
    this.wwriteA("<FONT FACE='" + fontface + "' SIZE=2><B>");
    this.wwrite("<TABLE WIDTH='100%' BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR='white'><TR><TD ALIGN=center>");
    vCode = this.getMonthlySchoolNameCode();
    this.wwrite(vCode);
    this.wwrite("</font></body></html>");
    this.gWinCal.document.close();
}

SchoolName.prototype.wwrite = function(wtext) {
    this.gWinCal.document.writeln(wtext);
}

SchoolName.prototype.wwriteA = function(wtext) {
    this.gWinCal.document.write(wtext);
}
SchoolName.prototype.cal_data = function() {
    var vCode = "";
    for (i=1; i<=vDay.length-1; i++)

    {

    vCode = vCode + "<TR>";

    for (j=0; j<1; j++) {

        vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "'>" +
            "<A style='COLOR: blue; ' HREF='#' " + "onClick=\"self.opener.document." + this.gReturnItem + ".value='" + vDay[i] + "';window.close();\">"+i+". " + vDay[i] + "</A>" + "</FONT></TD>";

    }
    vCode = vCode + "</TR>";}

    return vCode;
}

function SchBuild(p_item) {
    var p_WinCal = ggWinCal;
    gCal = new SchoolName(p_item, p_WinCal);

    gCal.gBGColor="white";
    gCal.gLinkColor="black";
    gCal.gTextColor="black";
    gCal.gHeaderColor="darkgreen";
    gCal.show();
}

function show_SchName()
{
    p_item = arguments[0];

    vWinCal = window.open("", "SchoolName","width=395,height=335,status=no,resizable=no,top=220,left=380");
    vWinCal.opener = self;
    ggWinCal = vWinCal;

    SchBuild(p_item);
}

// Manish's Code for get School Name on 24-Apr-2013 Ends Here
</Script>


这篇关于asp弹出窗口和返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆