Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Nov 2005
    Posts
    148
    Thanks
    1
    Thanked 0 Times in 0 Posts

    any idea on it? - innerHtml & http request return result

    Dear all,

    can anyone provide me some idea on how insert html code to a box (fix the height/ like textarea) by javascript?

    my problem:
    In my program, i had an upload function which allow user to upload an excel file and display out the content.

    Can you provide me some idea on how can i read the content and return in few part after the user upload the file? By using "setinterval"?

    how can i display the content in a box that had fix height (like textarea)? if the contents more that, a scroll bar will enable and let the user scroll down the contents.

    * i m using PHP and javascript in my program. The upload functin was using AJAX for that.

    thank a lot.
    Last edited by CstAn; 04-28-2007 at 12:58 PM.

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not aware of any way that your javascript can have access to a file on the local system without gonig through your server first. So the way I'd probably set it up is to use the input type="file" form to send it to the server then use ajax to poll when the upload is complete and download the bits you want for display.

    Maybe someone else knows a better way.

    david_kw

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    148
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by david_kw View Post
    I'm not aware of any way that your javascript can have access to a file on the local system without gonig through your server first. So the way I'd probably set it up is to use the input type="file" form to send it to the server then use ajax to poll when the upload is complete and download the bits you want for display.

    Maybe someone else knows a better way.

    david_kw
    this what i want to do.

    i plan had a upload file function and let the user upload the file to server.
    * only limit to excel file.

    all this process are done with AJAX.

    we assume that we had 1000 file of line in the excel file. How can i separate the file and return to user in different time? but the user do not need to execute the function.

    for example:
    when upload complete, it return 1st 50 line, then continue with next 5 line. But the user not need to execute the process.

    and the user jz see the result on the screen and a msg was show to user the process was running.

    can any one tell whether & how the javascript can access the local file, if the javascript can done it.

    thanks.


    how about we can insert a box by using javascript and inside had the contents of the file upload? the box must had fix height and weight as well as can insert html tag....like the textarea.

    thanks

  • #4
    Regular Coder
    Join Date
    Nov 2005
    Posts
    148
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I m using iframe now, but i cant refer to particular text box or textarea in the iframe with dynamic script.

    * i assign to each text box / textarea with different name. it assign with a prefix name plus a number count behind.
    for example: textBox_1, textBox_2, n etc...


    can anyone tell me how can i refer to particular text box?

    i can direct refer to it with:
    document.iframe.textBox_1.value...but i cant hard code it. cause the content are dynamic.

    thanks.

  • #5
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If I understand your question, I think you can do this

    document.iframe.textBox_1.value

    could be done with

    var box = 1;
    document.iframe['textBox_' + box].value

    then you could change the value of variable box as needed to address different ones.

    david_kw

  • #6
    Regular Coder
    Join Date
    Nov 2005
    Posts
    148
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thanks david_kw.


    i faced problem again.

    isn't anyway can we do like using Iframe?

    we cant call the function that place outside the iframe rite??
    *parent window.

    isn't anyway can do like the iframe, that we can fix the height of box?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •