...

View Full Version : Creating a new html page on client side using javascript



Rocky07
09-04-2011, 01:42 PM
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.

DanInMa
09-04-2011, 03:29 PM
you cant email from javascript. you have to have client side access.

Rocky07
09-05-2011, 08:55 AM
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?:(

Philip M
09-05-2011, 09:06 AM
AFAIK, the answer is no. :(

Arbitrator
09-05-2011, 09:15 AM
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).

Rocky07
09-05-2011, 11:40 AM
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?:confused:

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?:confused:

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.:o

Arbitrator
09-05-2011, 12:16 PM
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?:confused: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.

Rocky07
09-06-2011, 07:28 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum