473,473 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Build Form OTF (on the fly)

After much general searching, a JS newbie asks: can anyone point me to
where I can find out how to build a page (including form) using
Javascript? The reason I'd want to do this is because the page html is
becoming quite large due to form element attributes for each row of a
large form. I'm under the impression that I could condense this by
assigning variables to blocks of text that make up the page elements
and using script to write these elements to the window. Not only that,
but if I want to modify an attribute, I currently have to do it 25x
just for one column of the form. Being able to only modify a variable
once would propagate the change to the entire colum at least. Here's
an example of the length of just one table data tag (there are 5
similar tags per row):

<td width="72" align="center" height="22"><input type="text" READONLY
name="Item3" size="9" value="AS2K" style="height-style: 15;
text-align: Right; font-size: 8"></td>

I'm thinking that blocks of html such as everything in the above from
"<td" to "value=" could be one variable, and the "style=...8"> could
be another.
Would building the page using script be leaner?
Thanks,
Dave
Jul 20 '05 #1
2 2256
"Dave" <mi*******@mountaincable.net> wrote in message
news:cc**************************@posting.google.c om...
<snip>
<td width="72" align="center" height="22">
Every attribute in that tag can be replaced with separate CSS, the tag
doesn't even need a class or ID attribute as the CSS selector could be
context sensitive but even - class="colN" - would reduce the size of
that tag by 2/3.
<input type="text" READONLY
name="Item3" size="9" value="AS2K"
style="height-style: 15;text-align: Right; font-size: 8"></td>
And much the same can be said for this inline style attributes.
I'm thinking that blocks of html such as everything in the
above from "<td" to "value=" could be one variable, and the
"style=...8"> could be another.
Would building the page using script be leaner?


Of the many ways of approaching your problem JavaScript is probably the
worst. It looks like the appropriate application of CSS would nearly
half your pages size and move some of the attribute values to a
centralised location.

Having a complex form implies server-side scripting of some sort to
process the results so dynamically generating the page on the server
would be another option for inserting repetitive attribute values from a
common source. Though that would not reduced the download size in the
way that the appropriate use of CSS would.

Richard.
Jul 20 '05 #2
"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message news:<be*******************@news.demon.co.uk>...
"Dave" <mi*******@mountaincable.net> wrote in message
news:cc**************************@posting.google.c om...
<snip>
<td width="72" align="center" height="22">


Every attribute in that tag can be replaced with separate CSS, the tag
doesn't even need a class or ID attribute as the CSS selector could be
context sensitive but even - class="colN" - would reduce the size of
that tag by 2/3.
<input type="text" READONLY
name="Item3" size="9" value="AS2K"
style="height-style: 15;text-align: Right; font-size: 8"></td>


And much the same can be said for this inline style attributes.
I'm thinking that blocks of html such as everything in the
above from "<td" to "value=" could be one variable, and the
"style=...8"> could be another.
Would building the page using script be leaner?


Of the many ways of approaching your problem JavaScript is probably the
worst. It looks like the appropriate application of CSS would nearly
half your pages size and move some of the attribute values to a
centralised location.

Having a complex form implies server-side scripting of some sort to
process the results so dynamically generating the page on the server
would be another option for inserting repetitive attribute values from a
common source. Though that would not reduced the download size in the
way that the appropriate use of CSS would.

Richard.


To be truthful, I know little about CSS, but I guess I'll have to read
up on it as it sounds like the most viable solution. Server side
scripting is less desireable since we are not processing the results
(as I think you have surmised) unless you mean validation. That we are
doing using a js file. Thanks for the advice. I intend to take it.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bruce W...1 | last post by:
My PHP html file includes a header include, a form, and a footer include. After the user submits their information I want to replace the form part of the page with a thank you note. All the...
1
by: Akemi K. Buxton | last post by:
Hi, I'm a new PHP user so struggling a lot. I know this is silly question for you but I'll appreciate if you can help me. Here is my code. I need to send the data of $Sname in form1 to...
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
2
by: misschristalee | last post by:
I'm having a brain blockage day.... Scenario: Search Form with 6 text boxes Query has same six fields Each has this IIF: IIf(IsNull(!!),"",!!) with each dictating the correct text box of...
1
by: DaveF | last post by:
When I select the first dropdownlist box, I need to be able to make several dropdownlist boxes on the fly and populate them from the database. Is this possible? If so, HOW? -- David Fetrow...
9
by: yevvi | last post by:
Hi, We have a product with bunch of dlls which are now built with Visual Studio 2003. We want to switch the build to use VS2005. I have read that in VS2005 runtime libraries come as...
2
by: barry.edmund.wright | last post by:
Hi All, I want to build a Find Statement on the fly. The code below starting with 'This Code Works! is fine but as I said I want to build the Me!cboSelect1 & "=" & rs(Me!cboSelect1) portion of...
2
by: Coll | last post by:
I have a form and a query. I would like to have some control on the form (check box probably), that when selected will limit the criteria for a field in a query. Here are the details.... When...
0
by: Michael Justin | last post by:
For Java I have found a framework that helps to build form layouts, with the benefits of faster UI production, better UI code readability and better style guide compliance: ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.