<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="0.91">
    <channel>
        <title>standard method of writing script to a div or table ?</title>
        <description>The 10 most recently added comments in the topic &quot;standard method of writing script to a div or table ?&quot;</description>
        <link>http://www.freewaytalk.net/</link>
        <lastBuildDate>Tue, 06 Jan 2009 12:24:39 -500</lastBuildDate>
        <generator>FeedCreator 1.7.2</generator>
        <item>
            <title>Re: standard method of writing script to a div or table ?</title>
            <link>http://www.freewaytalk.net/thread/view/36552#m_36621</link>
            <description>&lt;p&gt;Hi Weaver and Walter :) 
thanks for the updated pointers and examples&lt;/p&gt;

&lt;p&gt;This has made it a lot more clear. 
The Weaver example worked and I have now been able in a naive sort of way move things around do different parts of the Freeway output. I did find the reference to (fwAddJavascript, fwAddRaw[Ln,Opt]) though I would have never understood what it meant!.. probably because I just dont know enough.&lt;/p&gt;

&lt;p&gt;Walter I am going to try to find the reference to fwMove as I will probably need to know how this works in comarison to Weavers example. At the moment I have only seen one reference to it in one of the Tech. notes and I think it was talking about Tables, but I will try to tally up your crowbar example and see if I can make sense of it.
Again thank you very much, and with a bit of luck you wont hear from me for a little while.&lt;/p&gt;

&lt;p&gt;thanks again to you both&lt;/p&gt;

&lt;p&gt;pems&lt;/p&gt;

&lt;p&gt;p.s. have you two ever thought about compiling examples and placing them in some sort of central pool. I know the documentation does cover quite a bit, but I assume things have moved on since they were written and the above explanations are a perfect example of really easy to follow instructions and line by line explanations.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;actionsdev mailing list
email@hidden
Update your subscriptions at:
&lt;a href=&quot;http://freewaytalk.net/person/options&quot;&gt;http://freewaytalk.net/person/options&lt;/a&gt;&lt;/p&gt;
</description>
            <author>pems</author>
            <pubDate>Sat, 19 Jul 2008 09:56:55 -500</pubDate>
        </item>
        <item>
            <title>Re: standard method of writing script to a div or table ?</title>
            <link>http://www.freewaytalk.net/thread/view/36552#m_36590</link>
            <description>&lt;p&gt;That&amp;#8217;s cool. There&amp;#8217;s also fwMove, which can move one tag after
another one. In CrowBar, that&amp;#8217;s the method I use, actually grabbing
the content of the parent DIV and moving it after the inserted code.&lt;/p&gt;

&lt;p&gt;Walter&lt;/p&gt;

&lt;p&gt;On Jul 18, 2008, at 8:44 AM, Weaver wrote:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Unless I am remembering this wrong&amp;#8230;&lt;/p&gt;
  
  &lt;p&gt;See pages 44-46 of the Action JSrefScreen.pdf about the methods
  (fwAddJavascript, fwAddRaw[Ln,Opt]).  The thing to note, though not
  completely explained, is the argument &amp;#8216;after&amp;#8217; or &amp;#8216;after tag&amp;#8217;.&lt;/p&gt;
  
  &lt;p&gt;The reference to your div, myDiv in the previous examples, may be
  used again as an effective pointer to the &amp;#8216;beginning&amp;#8217; of itself.&lt;/p&gt;
  
  &lt;p&gt;Example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var myDiv = fwDocument.fwTags.fwFind(fwItem,'div');
//so we have a reference to our div to which we want to add the JS

myDiv.fwAddRaw('string to add', myDiv);
//______________________________^^^^^ new AFTER argument
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;This last reference, since it is used in a method on itself
  effectively links to the opening tag of the &amp;#8216;div&amp;#8217;.&lt;/p&gt;
  
  &lt;p&gt;So the output would normally be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;
    {{other content}}
    CONTENT ADDED VIA FWADDRAW AS LAST ITEM
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;The trick adding &amp;#8216;myDiv&amp;#8217; as an argument in the fwAddRAw method
  inserts the content as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;
    CONTENT ADDED VIA FWADDRAW JUST AFTER OPENING TAG
    {{other content}}
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;P.S.
  This only works when myDiv is both the parent object and the
  &amp;#8216;after&amp;#8217; reference, else, the item added would be inserted after the
  entire myDiv tag:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;myParentDiv.fwAddRaw('text',myDiv);
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;would result in:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt; {myParentDiv}
    &amp;lt;div&amp;gt; {myDiv}
        {other content}
    &amp;lt;div&amp;gt;
    Inserted text with fwAddRaw
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;hr /&gt;
  
  &lt;p&gt;actionsdev mailing list
  email@hidden
  Update your subscriptions at:
  &lt;a href=&quot;http://freewaytalk.net/person/options&quot;&gt;http://freewaytalk.net/person/options&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;p&gt;actionsdev mailing list
email@hidden
Update your subscriptions at:
&lt;a href=&quot;http://freewaytalk.net/person/options&quot;&gt;http://freewaytalk.net/person/options&lt;/a&gt;&lt;/p&gt;
</description>
            <author>waltd</author>
            <pubDate>Fri, 18 Jul 2008 14:35:34 -500</pubDate>
        </item>
        <item>
            <title>Re: standard method of writing script to a div or table ?</title>
            <link>http://www.freewaytalk.net/thread/view/36552#m_36584</link>
            <description>&lt;p&gt;Unless I am remembering this wrong&amp;#8230;&lt;/p&gt;

&lt;p&gt;See pages 44-46 of the Action JSrefScreen.pdf about the methods (fwAddJavascript, fwAddRaw[Ln,Opt]).  The thing to note, though not completely explained, is the argument &amp;#8216;after&amp;#8217; or &amp;#8216;after tag&amp;#8217;.&lt;/p&gt;

&lt;p&gt;The reference to your div, myDiv in the previous examples, may be used again as an effective pointer to the &amp;#8216;beginning&amp;#8217; of itself.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var myDiv = fwDocument.fwTags.fwFind(fwItem,'div');
//so we have a reference to our div to which we want to add the JS

myDiv.fwAddRaw('string to add', myDiv);
//______________________________^^^^^ new AFTER argument
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This last reference, since it is used in a method on itself effectively links to the opening tag of the &amp;#8216;div&amp;#8217;.&lt;/p&gt;

&lt;p&gt;So the output would normally be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;
    {{other content}}
    CONTENT ADDED VIA FWADDRAW AS LAST ITEM
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The trick adding &amp;#8216;myDiv&amp;#8217; as an argument in the fwAddRAw method inserts the content as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt;
    CONTENT ADDED VIA FWADDRAW JUST AFTER OPENING TAG
    {{other content}}
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;P.S.
This only works when myDiv is both the parent object and the &amp;#8216;after&amp;#8217; reference, else, the item added would be inserted after the entire myDiv tag:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;myParentDiv.fwAddRaw('text',myDiv);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;would result in:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div&amp;gt; {myParentDiv}
    &amp;lt;div&amp;gt; {myDiv}
        {other content}
    &amp;lt;div&amp;gt;
    Inserted text with fwAddRaw
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;

&lt;p&gt;actionsdev mailing list
email@hidden
Update your subscriptions at:
&lt;a href=&quot;http://freewaytalk.net/person/options&quot;&gt;http://freewaytalk.net/person/options&lt;/a&gt;&lt;/p&gt;
</description>
            <author>Weaver</author>
            <pubDate>Fri, 18 Jul 2008 12:44:43 -500</pubDate>
        </item>
        <item>
            <title>Re: standard method of writing script to a div or table ?</title>
            <link>http://www.freewaytalk.net/thread/view/36552#m_36574</link>
            <description>&lt;p&gt;Thank you Walter for this description.&lt;/p&gt;

&lt;p&gt;I have been through the example and used it as a basis to experiment with. I have been able to disable some lines of your script and then enabling them again to see what they do and  how each element interacts. So a big thank you for this.
I have also looked at your Crowbar which again a great a source of information&amp;#8230; but most goes over my head at the moment but I will keep it handy so I can keep looking at it.&lt;/p&gt;

&lt;p&gt;I have only one question at the moment your example places the&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; dummy.fwAddRaw('Hello, world!');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;at then end of any normal content inside the div
do I need to use some other extra method to now move that content to be the first item in the div, or do I specify that in the existing code like this in some way&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; dummy.fwAddRawBefore('Hello, world!');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I know this doesn&amp;#8217;t make script sense because freeway /javascript wont know or understand what Before  means but is there a standard recognised method to place it at the beginning of the content, or do I now have to construct some new part of the script that moves it to the beginning?&lt;/p&gt;

&lt;p&gt;Again thanks for your example. It should be in the manual as it&amp;#8217;s the first thing I have seen that tackles this in simple terms.&lt;/p&gt;

&lt;p&gt;pems&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;actionsdev mailing list
email@hidden
Update your subscriptions at:
&lt;a href=&quot;http://freewaytalk.net/person/options&quot;&gt;http://freewaytalk.net/person/options&lt;/a&gt;&lt;/p&gt;
</description>
            <author>pems</author>
            <pubDate>Fri, 18 Jul 2008 06:11:36 -500</pubDate>
        </item>
        <item>
            <title>Re: standard method of writing script to a div or table ?</title>
            <link>http://www.freewaytalk.net/thread/view/36552#m_36559</link>
            <description>&lt;blockquote&gt;
  &lt;p&gt;On 17 Jul 2008, 3:20 pm, pems wrote:&lt;/p&gt;
  
  &lt;p&gt;Hi all&lt;/p&gt;
  
  &lt;p&gt;I sort generally understand how this works (please tell me if I am wrong)
  I could find a specific Tag by using for example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var divTag = fwDocument.fwtags.fwFind(&quot;div&quot;);
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;and if this was applied to a freeway layered html box this would find the div tag as in this example&lt;/p&gt;
  
  &lt;p&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you do &lt;code&gt;fwDocument.fwTags.fwFind(&quot;div&quot;)&lt;/code&gt;, you will find the first DIV in the page, probably the PageDiv, but that&amp;#8217;s not exactly guaranteed.&lt;/p&gt;

&lt;p&gt;If you want to find the DIV that represents the item your Action is applied to, then you would do&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var myDiv = fwDocument.fwTags.fwFind(fwItem,'div');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then you could start messing with myDiv &amp;#8212; adding things to it, moving its contents around, etc.&lt;/p&gt;



&lt;blockquote&gt;
  &lt;p&gt;I could then find other tags within the div using div.style  and I have found references to this in the actions tech Note 2.  so I  do have a reference for that&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just to be pedantic, you would find other &lt;em&gt;properties&lt;/em&gt; within the tag, not tags per se.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Now to my questions problems  which are twofold&lt;/strong&gt;&lt;/p&gt;
  
  &lt;p&gt;1 -  is there a standard equivalent to&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function fwAtContent() 
 fwDocument.fwWrite
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are several:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;myDiv.fwAdd(objectToAdd)
myDiv.fwAddRaw('html to add')
myDiv.fwAddRawln('html to add')
myDiv.fwAddRawOpt('html to add')
&lt;/code&gt;&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;p&gt;when I want to write to a freeway item
  Because different examples seem to have different methods to add data to a tag&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That&amp;#8217;s because there are different things you can add, and in different modes.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;2 -  and the other question which is related to this is: If I was successful in finding a Tag like:&lt;/p&gt;
  
  &lt;p&gt;&amp;lt;div id=&amp;#8221;item1&amp;#8221; style=&amp;#8221;position:absolute;left:135px; top:164px; width:244px; height:144px; z-index:1; font-size:1px&amp;#8221;&gt;
        &amp;lt;div&gt;&lt;/p&gt;
  
  &lt;p&gt;how do I add script after the opening div like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;item1&quot; style=&quot;position:absolute;left:135px; top:164px; width:244px; height:144px; z-index:1; font-size:1px&quot;&amp;gt; &amp;lt; script to be added &amp;gt;
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;I cant seem to find a reference to adding script between the end of the styles and the actual content of whatever that the div may contain.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you add the content to the found tag, using either the object or the raw method, it will be inserted inside that tag. So if you have a reference to your DIV, and you add another paragraph to it, that paragraph will be added to the end of the existing content.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;//get a reference to the item this action is applied to
var myDiv = fwDocument.fwTags.fwFind(fwItem,'div');
//make a new disposable tag to work with
var dummy = fwDocument.fwTags.fwAdd('');
//wrap this tag in a paragraph
dummy = dummy.fwAddEnclosing('p',true);
//add some text to it, the classic example text!
dummy.fwAddRaw('Hello, world!');
alert(dummy.fwToHTML());
//just so you can see where you have gotten at this point
myDiv.fwAdd(dummy);
//add the new dummy tag into the found tag
dummy.fwDelete();
//delete the dummy, otherwise it will print in your final HTML as the last line of code
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is an example of the object mode. You get the object that represents the selected tag, then you build up another object, and then you insert one into the other.&lt;/p&gt;

&lt;p&gt;If you wanted to insert a string of HTML or text into the DIV, then you would use one of the fwAddRaw methods. Have a look through the JavaScript Reference for the exact way they work, basically the differences between them have to do with line-break handling, and you would want to use the one that suits your application. If white-space is important to the operation of whatever you are inserting, then make sure you use fwAddRawln &amp;#8212; (that&amp;#8217;s a lower-case L, not a capital i).&lt;/p&gt;

&lt;p&gt;Hope this helps. A good Action to study for this sort of &amp;#8220;wedge something into another thing&amp;#8221; would be my CrowBar Action, available here: &lt;a href=&quot;http://freewaypro.com/actions/downloads&quot;&gt;http://freewaypro.com/actions/downloads&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Walter&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;actionsdev mailing list
email@hidden
Update your subscriptions at:
&lt;a href=&quot;http://freewaytalk.net/person/options&quot;&gt;http://freewaytalk.net/person/options&lt;/a&gt;&lt;/p&gt;
</description>
            <author>waltd</author>
            <pubDate>Thu, 17 Jul 2008 16:01:38 -500</pubDate>
        </item>
        <item>
            <title>standard method of writing script to a div or table ?</title>
            <link>http://www.freewaytalk.net/thread/view/36552</link>
            <description>&lt;p&gt;Hi all&lt;/p&gt;

&lt;p&gt;After many months of reading through Technotes, taking peoples advice and working through different Tutorials with a view to advancing my poor understanding of freeway 3 actions compared to the old simple actions, I am now at a point that I could do with a few pointers.&lt;/p&gt;

&lt;p&gt;Over the last few months I have been converting my simple actions into the more advanced 3 action with the help of all the Tech notes, Getting started with actions document and the JSrefernce manual, plus I have found a few books which also helped.&lt;/p&gt;

&lt;p&gt;Initially I have been concentrating using the simple:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function fwAtContent() 
 fwDocument.fwWrite('script to be added');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;to write fairly basic actions and to me this method seems fairly straight forward (very similar to the old non javascript simple actions), but I do know this only adds script to a standalone action (to the output stream), so are limited in there use&lt;/p&gt;

&lt;p&gt;My next step was to use the fwFind method to find a specific tag and than add code to the tags that Freeway outputs&lt;/p&gt;

&lt;p&gt;I sort generally understand how this works (please tell me if I am wrong)
I could find a specific Tag by using for example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var divTag = fwDocument.fwtags.fwFind(&quot;div&quot;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and if this was applied to a freeway layered html box this would find the div tag as in this example&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;item1&quot; style=&quot;position:absolute; left:135px; top:164px; width:244px; height:144px; z-index:1; font-size:1px&quot;&amp;gt;
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I could then find other tags within the div using div.style  and I have found references to this in the actions tech Note 2.  so I  do have a reference for that&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now to my questions problems  which are twofold&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1 -  is there a standard equivalent to&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function fwAtContent() 
 fwDocument.fwWrite
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;when I want to write to a freeway item
Because different examples seem to have different methods to add data to a tag&lt;/p&gt;

&lt;p&gt;2 -  and the other question which is related to this is: If I was successful in finding a Tag like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;item1&quot; style=&quot;position:absolute;left:135px; top:164px; width:244px; height:144px; z-index:1; font-size:1px&quot;&amp;gt;
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;how do I add script after the opening div like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;item1&quot; style=&quot;position:absolute;left:135px; top:164px; width:244px; height:144px; z-index:1; font-size:1px&quot;&amp;gt; &amp;lt;script to be added&amp;gt;
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I cant seem to find a reference to adding script between the end of the styles and the actual content of whatever that the div may contain.&lt;/p&gt;

&lt;p&gt;I hope I have explained my self and if any body could give me a tiny bit of direction it would be a really help.
thank you in advance&lt;/p&gt;

&lt;p&gt;pems&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;actionsdev mailing list
email@hidden
Update your subscriptions at:
&lt;a href=&quot;http://freewaytalk.net/person/options&quot;&gt;http://freewaytalk.net/person/options&lt;/a&gt;&lt;/p&gt;
</description>
            <author>pems</author>
            <pubDate>Thu, 17 Jul 2008 15:20:22 -500</pubDate>
        </item>
    </channel>
</rss>
