Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Roger_Pearse #1
Auto-fill table cells in a selection
Hello,
I'm fairly new to Dreamweaver, but I have an unusual problem, and would be
glad for some help.
I'm placing online an ancient piece of literature which, in the original is
laid out in tabular form. It's actually a chronicle, and has vertical columns
the number of years kings in different kingdoms have reigned, with notes of
things that happened that year against them. So:
|Romans | Greeks
|1 | 23 Eclipse of the sun.
|2 | 24 First battle of the Romans against the
Greeks.
|3 | 25
There are endless columns of these, and endless pages. I'm getting tired of
entering all these numbers.
What I would like to do is type a number in the top cell (e.g. 23 in the
above), select the next two cells in the column 'Greeks', and run a command
which will take the entry in the first cell (first selected cell?) and populate
the others with 24, 25, ... (adding one each time).
I hope this makes sense -- it's a devil to explain but obvious when you're
doing it.
Can anyone tell me how to write a command or macro to do this? I feel that it
must be possible -- just that my DW command-writing skills don't go very far
just yet.
One caveat -- the last person I asked suggested either that I use Excel and
import it, or use an OL tag. Neither is feasible for what I wish to do. It
does need to be something like 'select a set of cells in a
column, enter a number n in the first cell, press a key and the other cells
get filled with n+1, n+2, etc.'
Many thanks,
Roger Pearse
Roger_Pearse Guest
-
Auto fill email address
I've create a "e-mail back" button on a PDF form so that by clicking on the button, it will launch the default email program on their computer. My... -
Do not want Auto Fill Forms
I'm creating a form field in an already created pdf document. The form is for 5 people to sign there initials, type in the date, and hit a radio... -
Howto loop through table cells in a selection
Hello, I'm new to DW development, so I wonder if someone could help me. Say my user selects a few cells in a column in a table, and then runs my... -
auto fill form
<%@LANGUAGE='JAVASCRIPT' CODEPAGE='1252'%> SELECT distinct , make, , FROM ndcinventory ORDER BY model I have a form with drop down selection... -
How to fill in a selection, please
When I use the selection paintbrush to draw an outline around the perimeter of an object (e.g. the outside edge of the head of a person), is there an... -
BillB #2
Re: Auto-fill table cells in a selection
Create an Access database and do it in that. Set the first two columns as
autonumber
Bill
BillB Guest
-
Roger Pearse #3
Re: Auto-fill table cells in a selection
For anyone else who wants to know, the answer was:
[email]roger_pearse@yahoo.co.uk[/email] wrote in message news:<1111156512.453612.137340@o13g2000cwo.googleg roups.com>...Final solution: a file called Chronicon.htm in the c:\program> danilocelic *TMM* wrote:>> > Roger_Pearse wrote:> >> > > Hello,
> > >
> > > I'm new to DW development, so I wonder if someone could
> > > help me. Say my user selects a few cells in a column in
> > > a table, and then runs my command. How can I loop
> > > through the cells in the selection, so that I can read and
> > > write the text in each cell?
> > >
> > > I realise this is probably trivial if you know your way
> > > around the object model, but I don't, as yet.
> > Try something like the following:
> > var dom = dw.getDocumentDOM()
> > // grab multiple selections, which corespond to pair's of offsets
> > var sel = dom.getSelection(true);
> >
> > var objs = new Array();
> >
> > for(var i=0;i<sel.length;i+=2){
> > // take current selection pair and convert to a tag
> > // and stuff into an array to play with
> > objs.push(dom.offsetsToNode(sel[i],sel[i+1]));
> > }
> >
> > // set inertHTML of first node
> > objs[0].innerHTML='hello'
> Many thanks indeed -- I'll experiment.
files\macromedia\dreamweaver mx\configuration\commands folder.
Contents:
----start of file--
<html>
<script language=Javascript>
//-----------------------------
function populateCells() {
var dom = dw.getDocumentDOM()
// grab multiple selections, which corespond to pair's of offsets
var sel = dom.getSelection(true);
var objs = new Array();
//alert(sel.length/2); //--No of table cells selected
for(var i=0;i<sel.length;i+=2){
// take current selection pair and convert to a tag
// and stuff into an array to play with
objs.push(dom.offsetsToNode(sel[i],sel[i+1]));
}
// Value in first cell. Must subtract zero to force string to
// numeric.
var startValue = objs[0].innerHTML - 0;
if (startValue == 0) {
alert("First value in selection must contain a numeric");
return;
}
//-- Populate all cells
for(var i=0;i<sel.length/2;i++){
// set inertHTML of first node
objs[i].innerHTML= i + startValue;
}
} //--End of populateCells
//------------------------------
</script>
<body OnLoad=populateCells()>
</body>
</html>
----end of file---
Many thanks indeed!
All the best,
Roger Pearse
Roger Pearse Guest



Reply With Quote

