Adding a Style?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • designbydaniel
    New Member
    • Jan 2008
    • 2

    Adding a Style?

    Hey guys,

    How can I add a style to the image element that generating from this code? I mean, I assume that all I have to is add this line somewhere,

    .NameOfTheStyle

    Right?

    =============== =============== =============== ==========


    [CODE=javascript]<!--
    function MM_preloadImage s() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i]; }}
    }

    function MM_swapImgResto re() { //v3.0
    var i,x,a=document. MM_sr; for(i=0;a&&i<a. length&&(x=a[i])&&x.oSrc;i++ ) x.src=x.oSrc;
    }

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_sw apImage.argumen ts; document.MM_sr= new Array; for(i=0;i<(a.le ngth-2);i+=3)
    if ((x=MM_findObj( a[i]))!=null){docum ent.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->

    <!--
    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf ("?"))>0&&paren t.frames.length ) {
    d=parent.frames[n.substring(p+1 )].document; n=n.substring(0 ,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.fo rms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.l ayers&&i<d.laye rs.length;i++) x=MM_findObj(n, d.layers[i].document);
    if(!x && d.getElementByI d) x=d.getElementB yId(n); return x;
    }
    //-->

    [/CODE]
    =============== =============== =============== ==========


    Thanks a lot.
    Last edited by gits; Jan 8 '08, 07:42 AM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    even when i hate that crappy dreamweaver-code ... :) ... it seems that it uses a variable x in the functions to store a reference to the image, so for example try:

    [CODE=javascript]x.style.width = '200px';[/CODE]
    so as you can see ... it's:

    Code:
    node_ref.style.style_property_name = value;
    kind regards

    Comment

    • designbydaniel
      New Member
      • Jan 2008
      • 2

      #3
      Hey thanks a lot. But I couldn't get it to work... I guess I don't know anything... Amway how can I add a Class that is generating from another JS file to this Dreamweaver code?

      Thanks a lot.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        to add a class you may use:

        [CODE=javascript]x.className = 'your_class_nam e';[/CODE]
        kind regards

        Comment

        Working...