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 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating a new html page on client side using javascript

    Hi,

    I am creating a HTML page and mailing it to the user(client side). This html page contains a Table and a button. On button click, I would like to create another HTML page based on the detail in the table,dynamically on run time and Open the newly created HTML. I need to use javascript to achieve this functionality. I have no Server-Client Configuration. And I need to run the Javscript only on client side to process the First HTML's table data and Create a new HTML page. The output of the javascript should also be put
    in a table format in the newly created HTML page.

    Here is some background information:
    The details from one server would be put into this first HTML along with a button. This HTML page is then mailed to Client side. The javascript in the HTML page then processes the Table data of first HTML. This can only be run at Client Side,once the user clicks the button and moreover I dont have Server-Client Configuration. I am creating a report and mailing it, For formatting purposes and for creating hyperlink to mailid's I chose HTML, Now I am struck here. Could some one please help me out with this.

    Thanks for your time.

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    you cant email from javascript. you have to have client side access.

  • #3
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am not emailing from javascript, I am mailing the html page from another server to user inbox(outlook). When the user opens this HTML page and clicks the button, I want a new HTML page to be created and displayed dynamically. Is there some way to do this?

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,037
    Thanks
    203
    Thanked 2,539 Times in 2,517 Posts
    AFAIK, the answer is no.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #5
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Quote Originally Posted by Rocky07 View Post
    When the user opens this HTML page and clicks the button, I want a new HTML page to be created and displayed dynamically. Is there some way to do this?
    You can dynamically alter the emailed HTML document to display what you want, but you cannot dynamically create an HTML file using ECMAScript/JavaScript.

    Further, you would need to send this HTML document as an attachment which the user would have to open and load in their Web browser since, as far as I'm aware, every email client either disables scripting by default or simply doesn't support scripting at all (for security reasons).
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #6
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is this option possible?

    Hi,

    Thanks for your time. I have few other questions. The HTML will be saved in local system first and then the script is run due to security issues, as mentioned. Basically the html would be created in unix and then it would be mailed to user in Windows(Outlook). The details sent from UNIX in HTML are in Table cells. Now, this table is in Body section of HTML. This is the detail that my javascript would be working on.

    From this point, I have other option too(but I dont know if this is possible), instead of running the javascript on button click and creating the new HTML,
    Is it possible to run the script before loading the table itself?

    I mean like, I have the script to store the table cell's value in array on button click. Is it possible to run this script before table load/Page load? and moreover, if the previous option is possible, Since the values can be stored in a Array, I wont need the table any more. So, after processing the details, can I now replace the contents of the same table(from where the details are fetched) before displaying the table/Page?

    This way I wont need to create a new HTML.. I am totally new to this front end design, HTML and javascript, so pardon any naive questions.

  • #7
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Quote Originally Posted by Rocky07 View Post
    I mean like, I have the script to store the table cell's value in array on button click. Is it possible to run this script before table load/Page load? and moreover, if the previous option is possible, Since the values can be stored in a Array, I wont need the table any more. So, after processing the details, can I now replace the contents of the same table(from where the details are fetched) before displaying the table/Page?
    JavaScript cannot do this; JavaScript is a client-side language and you can't do client-side scripting directly via email.

    You should build HTML documents on your server (using a server-side language such as PHP), and then send those finished HTML documents as email.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #8
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Completed the requirement. Changed the contents of HTML table

    I wrote a script to change the cell values of HTML table after processing the details on button click. It worked.
    I think this should serve the purpose, instead of creating a new HTML.
    Thanks for your help.


  •  

    Tags for this Thread

    Posting Permissions

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