Adding extra style attributes to the page div

Hi everyone
me again and as usual I know my question will sound a bit dim but here goes anyway. If I just want to add an extra style attribute to the page div is there a simple way to do it. I understand (and have successfully with a lot of help) added things using my actions within the HTML tags but I have never tackled adding extra style attributes. I have looked at the

    function GetCSSAttribute(tag, fieldName, attributeName)

within the manual and “my goodness” this looks like an enormous amount of code just to add 1 attribute, is this the only way?
If someone could point out, what I need to use so I can add some extra style attributes or if there was a simple alternative then that would very handy

Pems :slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes. The issue is that internally, Freeway stores the styles applied
to an element as a single string, rather than an object or some other
key:value data structure. I have rewritten the get and set CSS
functions slightly, my versions follow in a Gist.

Walter

On Oct 24, 2010, at 4:23 PM, pems wrote:

Hi everyone
me again and as usual I know my question will sound a bit dim but
here goes anyway. If I just want to add an extra style attribute to
the page div is there a simple way to do it. I understand (and have
successfully with a lot of help) added things using my actions
within the HTML tags but I have never tackled adding extra style
attributes. I have looked at the

   function GetCSSAttribute(tag, fieldName, attributeName)

within the manual and “my goodness” this looks like an enormous
amount of code just to add 1 attribute, is this the only way?
If someone could point out, what I need to use so I can add some
extra style attributes or if there was a simple alternative then
that would very handy

Pems :slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Walter
I thought this might be the case (it looks so complicated :frowning: )
So just so I can try and get my head around what you have shown

  1. Do I have to have both parts to add an attribute: so that would be the SetCSSAttribute and the GetCSSAttribute
    and sorry for being slow here, but
  2. Where in all that script does the action pinpoint the PageDiv style as the one I want to target.
    Normally I would look for a tag like style or body and once I have that I can then add to it but I just don’t recognise an of the script, especially the: (/^s*(S*(s+S+))s$/, “$1”); //javascript equivalent of trim part.
    I have no idea what this is referring to, so I wouldn’t know if I had to adjust it and to what to.

Again (and as usual) apologies for my lack of knowledge

Pems


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You’ll need to get a handle on the PageDiv separately, then run the
function against it, inserting your handle as the tag attribute (the
first attribute) of the function. Off the top of my head:

function fwAfterEndBody(){
	var divs = fwDocument.fwTags.fwFindAll("div");
	for(i in divs){
		var div = divs[i];
		if(div.id && div.id == 'PageDiv'){
			addCSSAttribute(div, 'class',
				'myNewClassName');
		}
	}
}

Walter

On Oct 25, 2010, at 8:32 AM, pems wrote:

Thanks Walter
I thought this might be the case (it looks so complicated :frowning: )
So just so I can try and get my head around what you have shown

  1. Do I have to have both parts to add an attribute: so that would
    be the SetCSSAttribute and the GetCSSAttribute
    and sorry for being slow here, but
  2. Where in all that script does the action pinpoint the PageDiv
    style as the one I want to target.
    Normally I would look for a tag like style or body and once I have
    that I can then add to it but I just don’t recognise an of the
    script, especially the: (/^s*(S*(s+S+))s$/, “$1”); //
    javascript equivalent of trim part.
    I have no idea what this is referring to, so I wouldn’t know if I
    had to adjust it and to what to.

Again (and as usual) apologies for my lack of knowledge

Pems


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Pems
I thought I better chuck this in as an alternative (Although this is probably not ideal). and a bit of a ham fisted way to do something.

If I have read your request correctly then what you are trying to do is add a style attribute and not change one.
Well there is a simple cheat… rather than having to add the script as walter has mappped out which is the correct way, you can just tack on to the end… what I mean by that is use something like this on the Page div once you have got a handle on it.

code fagment:

tagAsText = tagAsText.replace(/">/g,'; add your attriubute here">');

as long as you have found your pageDiv then this would remove the "> from the end of the style attribute and then replace it with add your attriubute including the ">

it does have some shortcomings but it at least it means it’s not a huge amount of code to add just an attriubute

All the best max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the explanations
Now to try and put them into practice

Pems :slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options