By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,136 Members | 1,087 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,136 IT Pros & Developers. It's quick & easy.

Adding a Style?

P: 2
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?

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


Expand|Select|Wrap|Line Numbers
  1. <!--
  2. function MM_preloadImages() { //v3.0
  3.   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  4.     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  5.     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i]; }}
  6. }
  7.  
  8. function MM_swapImgRestore() { //v3.0
  9.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  10. }
  11.  
  12. function MM_swapImage() { //v3.0
  13.   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  14.    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  15. }
  16. //-->
  17.  
  18. <!--
  19. function MM_findObj(n, d) { //v4.01
  20.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  21.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  22.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  23.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  24.   if(!x && d.getElementById) x=d.getElementById(n); return x;
  25. }
  26. //-->
  27.  
  28.  
================================================== =====


Thanks a lot.
Jan 8 '08 #1
Share this Question
Share on Google+
3 Replies


gits
Expert Mod 5K+
P: 5,333
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:

Expand|Select|Wrap|Line Numbers
  1. x.style.width = '200px';
so as you can see ... it's:

Expand|Select|Wrap|Line Numbers
  1. node_ref.style.style_property_name = value;
  2.  
kind regards
Jan 8 '08 #2

P: 2
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.
Jan 9 '08 #3

gits
Expert Mod 5K+
P: 5,333
to add a class you may use:

Expand|Select|Wrap|Line Numbers
  1. x.className = 'your_class_name';
kind regards
Jan 9 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.