• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Copying Rollover Images?

Participant ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

Hi, does anybody know why you can’t copy and paste a rollover image from one place into another in a DW file? I’ve made some links buttons where when you rollover the button you get a rollover image and when you click on it it takes you to the link. However, when I copy the rollover image in the file and paste it somewhere else the rollover doesn’t work. Why is this? The buttons in question are at the top of this file. The social media links … http://www.maximum-robot.co.uk/

Many thanks for your help,
Gareth

TOPICS
How to

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 08, 2022 Dec 08, 2022

Something might be getting corrupted when you copy and paste.

Pay close attention to the ids in the images, and the id in the script accompanying them. They need to match for each image/script, but they also need to be unique to the page.

I don't use the latest version, but when I tried to copy/paste behaviorized buttons in it, DW changed all the ids to "999" breaking everything. 

Votes

Translate

Translate
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

When you say copy and paste, do you also include the JavaScript?

<script type="text/javascript">
function MM_swapImgRestore() { //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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 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_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.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.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.osrc=x.src; x.src=a[i+2];}
}
</script>

And do you have the correct links to the images?

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

Hi Ben, I didn't copy any script, just teh image in design mode. I will experiment again! Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

Are you...

1. Duplicating the buttons within the same page (likely name/id conflict)...
2. Moving them to another location in the same page (should work fine), or...
3. Copying them to a new file (would also require copying the script as Ben points out)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

No, I'm pasting them into the same page. The link still works but the rollover doesn't work on either image, the original one or the one I've pasted elsewhere. However, I haven't tried deleting the original so there is only one copy on the page. The method I'm using is select the button image in the design mode and pasting somewhere else in the file. Not copying and pasting the code in code mode. I will experiment a bit more. Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

If you're making a second set of buttons on the same page, the problem would be the ids used in DW behaviors. They can only be used once per page, so duplicating the buttons duplicates the ids, causing a conflict with the scripts running the rollovers.

To fix it, you'll need to give the new rollover images their own ids (BandCamp2 for example) and switch the id in the script to match. Here's an example of a duplicate BandCamp button...

<a href="https://maximumrobot.bandcamp.com/" target="_blank" onMouseOver="MM_swapImage('BandCamp2','','promotion/images/BandCamp_72_R.jpg',1)" onMouseOut="MM_swapImgRestore()"><img src="promotion/images/BandCamp_72.jpg" name="BandCamp2" width="91" height="40" border="0"></a>



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

I don't need them twice. I'm just trying to move them to somewhere else on the page. It also doesn't work if you delete the original so there is only one of the rollover on the page. I'll experiment with the code. Thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

You can have two copies working, just change the name for the second instance as in:

 

<td width="200" height="200" valign="top" bgcolor="#333333"><span class="MainText1"><a href="https://maximumrobot.bandcamp.com/album/absorb-the-shock" target="_blank" onMouseOver="MM_swapImage('Gaz2','','assets/images/Gaz2.jpg',)" onMouseOut="MM_swapImgRestore()"><img src="assets/images/Gaz1.jpg" name="Gaz2" width="200" height="200" border="0"></a></span></td>
 
Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

Something might be getting corrupted when you copy and paste.

Pay close attention to the ids in the images, and the id in the script accompanying them. They need to match for each image/script, but they also need to be unique to the page.

I don't use the latest version, but when I tried to copy/paste behaviorized buttons in it, DW changed all the ids to "999" breaking everything. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 09, 2022 Dec 09, 2022

Copy link to clipboard

Copied

LATEST

Thanks Jon, that is what has happened. I'm pretty sure I can fix it now. It's put in 999 in the code instead of the rollover name. Thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

Unable to connect to URL. 

 

 

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

http://www.maximum-robot.co.uk/

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

No soup for me.

 

image.png

 

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines