Web Analytics Made Easy -
StatCounter Export the conten of a window to a text editor - CodingForum

Announcement

Collapse
No announcement yet.

Export the conten of a window to a text editor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Export the conten of a window to a text editor

    Hello everybody,

    I would like to export the coneten of a window to a text editor(notepad, word,...) when I click on the button "Export". I' ve tried the the following code (export to notepad) but I dont get even the notepad open..

    Any suggetion?




    <html>
    <head>

    <script language="vbscript">
    Function export ()
    Dim WshShell
    ' déclaration of a WshShell objet
    Set WshShell = CreateObject("Wscript.Shell")

    ' start notepad to the client side
    WshShell.Run "%windir%\notepad "

    ' destruction of the WshShell objet
    Set WshShell = nothing
    End Function

    </script>


    <script type="text/javascript"><!--
    function showdata (f) {
    var myWin = window.open('', '', 'width=500,height=550,toolbar=no,scrollbars=no,sta
    tus=no,menubar=no');
    var msg = '<html><head><title>Data</title></head><body bgcolor="white">';
    msg+= '<table border="0"><tr><td colspan="2" align ="center"><b>your data</b> </td></tr>';
    msg+= '<tr><td> Name : </td><td>' + f.myname.value + '</td></tr>';
    msg+= '<tr><td> first name: </td><td>' + f.myfname.value + '</td></tr>';
    msg+= '<tr><td> Adress : </td><td>' + f.myadress.value + '</td></tr>';
    msg+= '<tr><td> Zipcode: </td><td>' + f.Zip.value + '</td></tr>';
    msg+= '<tr><td><form><input type="button" value="Printdata" onClick="window.print()"></td></tr>';
    msg+= '<tr><td><input type="button" value="Export" onClick="export()"></from></td></tr></table>';
    msg+= '</body></html>';
    myWin.document.open();
    myWin.document.write(msg);
    myWin.document.close();
    } //-->
    </script>
    </head>
    <body bgcolor="#80FBFF">
    <form method="POST" action="Emailen.asp" name="myform">
    <table border="1" width="70%" cellspacing="0">
    <tr><td><input type="text" name="myname"></td></tr>
    <tr><td><input type="text" name="myfname"></td></tr>
    <tr><td><input type="text" name="myadress"></td></tr>
    <tr><td><input type="text" name="Zip"></td></tr>
    <tr><td><input type="button" value="zend" name="btnverzend" onClick="showdata(myform)"></td>
    </tr>
    </table>
    </form>

    </body>
    </html>

  • #2
    First off you are going to use VBScript so that is going to run into a lot of compliance issues


    Second off you are agam calling a code that is not generated in the pop up window. We brought this up the last time you posted your question

    You need to either include the code in the pop up or referece the function from the child. window.opener.FunctionName()

    Now if you are only planning on doing this with IE, I suggest thta you look into an active X control since it probably do this better.

    My 2 cents
    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

    Comment

    Working...
    X