It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JS functions in HTML not found

Hi guys,

i have one question for you. i currently try to program html + jS in a HTML macro.

i want to create a mouseOver Action when mouse goes over an image.

the code works in the preview, but when i press "Save" i got warnings the JS functions are not defined.

(MM_swapImmRestore(), MM_swapImage()).

Any idea what i made worng.

Thx for your help.

<html> <head>
<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];}

<body onload="MM_preloadImages('http://kebwiki/download/attachments/57377183/Image1.png','http://kebwiki/download/attachments/57377183/Image2.png','http://kebwiki/download/attachments/57377183/Image3.png','http://kebwiki/download/attachments/57377183/Image4.png')">
<div id="keba_icons">
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','http://kebwiki/download/attachments/57377183/Image1.png',1)"><img src="http://kebwiki/download/attachments/57377183/Image1_1.png" name="Image1" border="0" id="Image1" /></a>
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','http://kebwiki/download/attachments/57377183/Image2.png',1)"><img src="http://kebwiki/download/attachments/57377183/Image2_1.png" name="Image2" border="0" id="Image2" /></a>
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','http://kebwiki/download/attachments/57377183/Image3.png',1)"><img src="http://kebwiki/download/attachments/57377183/Image3_1.png" name="Image3" border="0" id="Image3" /></a>
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','http://kebwiki/download/attachments/57377183/Image4.png',1)"><img src="http://kebwiki/download/attachments/57377183/Image4_1.png" name="Image4" border="0" id="Image4" /></a>
</html> {html}

1 answer

This HTML is not valid. You can't nest a full HTML document inside another. Things are bound to break.

Also, rather than pasting some old-fashioned squirrel code that looks like it was generated by Dreamweaver, it would be nicer to write it afresh with modern HTML/CSS - it makes debugging somewhat easier.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Align

Best Practices in Jira Align

Hello Jira Align customers! In order to better serve you on your journey with Jira Align, the Community team has worked with the Jira Align team to curate the content in this collection to better s...

68 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you