Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

document.write(" MEGA HTML");

Featured Replies

Hello people!

I was wondering if anyone has knowledge/experience on how browsers digest A LOT OF lines of JavaScript. I am forced ( I think) to use it but I would like to decorate it with HTML.So my page goes something like this:

-------------------------------------

<body>

<script>

document.write("<table width="100%" height="496" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#666666" id="MAINTABLE">");

document.write("<tr>");

document.write("<td align="center" valign="middle"> ");

document.write("<table width="99%" height="494" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" id="INSIDETABLE">");

document.write("<tr>");

document.write("<td width="40%" height="25"><hr size="1" color="#666666"> </td>");

document.write("<td width="20%" height="25" align="center" class="maskL">ALL REPORTS</td>");

document.write("<td width="40%" height="25"><hr size="1" color="#666666"> </td>");

document.write("</tr>");

........ ETC.

---------------------------

so I was wondering about the speed of all this or an alternative solution!

thanx

You could use tables like this:

<body>

<table .... >

<script>var tot_qty = 0; var loc_total; var curr_loc = "<b>Location</b>";

[FMP-Record]

if (curr_loc == "[FMP-Field:locations::location_name]")

    {

       loc_total += [FMP-Field:qty];

    tot_qty += [FMP-Field:qty]; }

else

    {

    document.write("<tr><td>" + curr_loc + "</td><td>|</td><td>" + loc_total + "</td></tr>");

    curr_loc = "[FMP-Field:locations::location_name]";

    loc_total = [FMP-Field:qty];

    tot_qty += [FMP-Field:qty];

    } ;           

[/FMP-Record]

document.write("<tr><td>" + curr_loc + "</td><td>|</td><td>" + loc_total + "</td></tr>");

document.write("<tr><td colspan='3'>Total Quantity: " + tot_qty + "</td></tr>");</script>

</table>

</body>

However, any speed differences would be tiny.

All the best.

Garry

  • Author

laugh.gif thanx Garry!

p.s. Didn't want to "bother you directly" that's why the topic is as it is!

thanx

  • Author

I forgot that <script> can be stuck driectly into the body of html....we get spoiled by WYSIWYG editors.

Thanx again

I did use once quite lot "document.write" with many conditions and no one spot the difference in rendering.

It was the only way to do really complicated things with WC page e.g. variable size of fields depending on size of monitor.

First my reaction was "impossible with CDML", but I did managed with JS. Then I got cold shower from boss, that I am negative, bla, bla smile.gif

  • Author

hey Garry!

quick question on Java Script:

this part in particular:

...................

else {

document.write("<tr><td>" + curr_loc + "</td><td>|</td><td>" + loc_total + "</td></tr>");

...................

It will ALWAYS display default values (curr_loc and loc_total)of variables that are "0" zero as declared on top. So the output is always:

Location | 0

Location1| X

Location2| xx

....

is there a way to get rid of the first line that is generated OR better yet tweak it so it shows text of my choice

  • Author

Garry's:

Use this:

...................

else {

if (curr_loc != "") { document.write("<tr><td>" + curr_loc + "</td><td>|</td><td>" + loc_total + "</td></tr>"); } ;

...................

Initialise curr_loc as "".

You can add a row before the script starts:

<tr><td><b>Location</b></td><td><b>Qty</b></td><td><b>Sales</b></td></tr>

Hope this helps.

Garry

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.