Urgent:Copy data from notepad/excel..simple though

Discussion in 'Javascript' started by cv, Jul 14, 2003.

  1. cv

    cv Guest

    Hi all,

    I have to copy two set of data from 2 files(notepad/excel) say,
    products and their corresponding prices to list/textarea/table. I
    should be able to retrieve the product and corresponding price
    information from the control(list/textarea/table). Which is the best
    way? Quite urgent.. pls let me know.

    TIA, cv
     
    cv, Jul 14, 2003
    #1
    1. Advertisements

  2. cv

    Grant Wagner Guest

    Open the file in Notepad, select the text you want to copy, select Edit
    -> Copy.

    Go into your favorite web page editor, select Edit -> Paste. Edit as
    required.

    Alternatively you could use File -> Save as HTML in Microsoft Excel,
    then copy and paste the table it creates into your web page editor and
    modify it as necessary.


    The point is, what you want can't be accomplished by client-side
    JavaScript in the default security environment, and although it's
    possible to automate it using either VBScript in Microsoft Excel, or by
    using the Windows Script Host, you'll probably need assistance
    completing the task.

    --
    | Grant Wagner <>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    *
    http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

    * Internet Explorer DOM Reference available at:
    *
    http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

    * Netscape 6/7 DOM Reference available at:
    * http://www.mozilla.org/docs/dom/domref/
    * Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
    * http://www.mozilla.org/docs/web-developer/upgrade_2.html
     
    Grant Wagner, Jul 14, 2003
    #2
    1. Advertisements

  3. cv

    cv Guest

    hi again,
    do you mean to say it is not possible at all to copy/paste a set of
    data like

    123 $
    456 €
    789 @

    like this to a html textbox/html list/html textarea and to get the
    values in the next page after i submit the page??
    thanx for any input, cv
     
    cv, Jul 15, 2003
    #3
  4. cv

    Grant Wagner Guest

    Client-side JavaScript is unable to perform the copy/paste, which is what I thought you wanted. If you want
    to move data from one page to another, you can put whatever data you want in whatever form elements you want,
    then use:

    <form action="nextPage.htm" method="GET">

    On nextPage.html, you'd have:

    var sSearch = window.location.search.substring(1);
    var Parameters = new Object();
    var sNameValuePairs = sSearch.split('&');
    var sNameValuePair;
    for (var i = 0; i < sNameValuePairs.length; i++) {
    sNameValuePair = sNameValuePairs.split('=');
    Parameters[sNameValuePair[0]] = sNameValuePair[1];
    }
    // now each item passed on the URL is in
    // Parameters[itemName]
    // so the value of your parameter can be accessed via
    // Parameters["lastName"]

    Of course, all the data you pasted would be in a single input (Parameters["whatYouPasted"]). You'll have to
    parse it using .split(), then you could document.write() it as an HTML table.

    --
    | Grant Wagner <>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    * http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
    * Internet Explorer DOM Reference available at:
    * http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
    * Netscape 6/7 DOM Reference available at:
    * http://www.mozilla.org/docs/dom/domref/
    * Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
    * http://www.mozilla.org/docs/web-developer/upgrade_2.html
     
    Grant Wagner, Jul 15, 2003
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.