Re: CuteEditor In a Child Window

  •  02-22-2004, 6:25 PM

    Re: CuteEditor In a Child Window

    I figured I'd also post what I have working and maybe you can help me get to the finishline.  Basically, instead of the TextArea on the 2nd page, I want to have it be the Cute Editor.  Thanks a million in advance.

     

    2 ASP pages:  dad.asp and kid.asp

     

    Dad.asp


    <HTML>
    <HEAD>
    <SCRIPT>
    function popupCuteEditor(v_form, v_field)
    {
    var newWin, v_pagestring;
     v_pagestring = "kid.asp?form=" + v_form + "&field=" + v_field;
     newWin =window.open(v_pagestring,"HTMLEdit",'resizable=yes,scrollbars=yes,width=700,height=500,toolbar=yes')
    }
    </SCRIPT>

    <TITLE>Parent Page</TITLE>

    </HEAD>

    <BODY>
    <FORM name="f1" action="kid.asp" method=POST target='kid' onSubmit="updateitems.asp">
    <textarea name="t1" cols="42" rows="5">Text Area 1 Text</textarea><br>
    <input type="button" value="Edit In CuteEditor" name="B1"  onclick="popupCuteEditor('f1','t1')">
    <p></p>


    <textarea rows="5" name="t2" cols="42">Text Area 2 Text</textarea><br>
    <input type="button" value="Edit In CuteEditor" name="B2"  onclick="popupCuteEditor('f1','t2')">

    <p>
    <INPUT type="submit" value=Submit>
    </p>
    </FORM>

    </BODY>
    </HTML>

     

    kid.asp


    <HTML>
    <HEAD>
    <script>

    // querystring
    // Call function by x = querystring("variable") returns variable=x
    function querystring(key)
    {

    var value = null;
    for (var i=0;i<querystring.keys.length;i++)
    {
    if (querystring.keys[i]==key)
    {
    value = querystring.values[i];
    break;
    }
    }
    return value;
    }


    querystring.keys = new Array();
    querystring.values = new Array();

    function querystring_parse()
    {
    var query = window.location.search.substring(1);
    var pairs = query.split("&");

    for (var i=0;i<pairs.length;i++)
    {
    var pos = pairs[i].indexOf('=');
    if (pos >= 0)
    {
    var argname = pairs[i].substring(0,pos);
    var value = pairs[i].substring(pos+1);
    querystring.keys[querystring.keys.length] = argname;
    querystring.values[querystring.values.length] = value;
    }
    }
    }
    querystring_parse();

    // Set the parent windows form and field to a variable

    var v_parentform, v_field, v_form;
    v_field = querystring("field");
    v_form = querystring("form");

    var v_parent = "window.opener.";
    v_parentform = eval(v_parent + v_form);


    function tellDad()
    {
    v_parentform.elements[v_field].value=document.f2.t3.value;
    }


    function getparentdata()
    {
    document.f2.t3.value = v_parentform.elements[v_field].value;
    }

    </SCRIPT>

    <TITLE>Kid Child Window</TITLE>

    </HEAD>

    <BODY onload="getparentdata()">

    <FORM name="f2"  method=POST >
    The area below I would like to be the Cute Editor instead of a Textarea<br>
    <textarea rows="4" name="t3" cols="34"></textarea><br>

    <INPUT type="button" value='Change Parent value' onClick="tellDad(); window.close();" >


    </FORM>
    </BODY>
    </HTML>

     

View Complete Thread