Re: retrieve data from editor

  •  01-09-2006, 1:47 PM

    Re: retrieve data from editor

    Darryl,
     
     
    Here it is:
     
     
    Dad.htm
     
    <HTML>
    <HEAD>
    <SCRIPT>
    function popupCuteEditor(v_form, v_field)
    {
     var newWin, v_pagestring;
     w = 770;
     h = 500;
     LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
     TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
     settings = 'height='+h+',width='+w+',top='+TopPosition+',left='; 
     v_pagestring = "kid.aspx?form=" + v_form + "&field=" + v_field;
     newWin =window.open(v_pagestring,"HTMLEdit",settings + LeftPosition+'resizable=yes')
    }
    </SCRIPT>
    <TITLE>Parent Page</TITLE>
    </HEAD>
    <body>
     <p></p>
     <FORM name="f1" method=POST target='kid'>
      <textarea name="t1" cols="100" rows="15">Text Area 1 Text</textarea><br/>
      <input type="button" value="Edit In CuteEditor" name="B1"  onclick="popupCuteEditor('f1','t1')">
     </FORM>
    </BODY>
    </HTML>


    Kid.aspx
     
    <%@ Page Language="C#" %>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <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.keysIdea [I]==key)
      {
       value = querystring.valuesIdea [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 = pairsIdea [I].indexOf('=');
      if (pos >= 0)
      {
       var argname = pairsIdea [I].substring(0,pos);
       var value = pairsIdea [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()
    {
     // get the cute editor instance
     var editor1 = document.getElementById('<%=Editor1.ClientID%>');
        
     // Get the editor HTML
     v_parentform.elements[v_field].value = editor1.getHTML();
    }
    function getparentdata()

     // get the cute editor instance
     var editor1 = document.getElementById('<%=Editor1.ClientID%>');
     
     // Set the editor
     editor1.setHTML(v_parentform.elements[v_field].value);
     
    }
    </SCRIPT>
    <TITLE>Kid Child Window</TITLE>
    </HEAD>

    <body bottomMargin="0" topMargin="0" marginwidth="0" marginheight="0" onload="setTimeout(getparentdata,1000);" bgcolor="#efefef">
     <form runat="server">
     <CE:Editor  EditorWysiwygModeCss="style.css" id="Editor1" runat="server" ></CE:Editor>
     <br/>
     <INPUT type="button" value='Get Parent data' onClick="getparentdata();" >
     <INPUT type="button" value='Set Parent value' onClick="tellDad(); window.close();" >
     <br/>
    </form>
    </BODY>
    </HTML>

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread