Hype referencing 2 instances of the same image in preview


(Joyce Vogt) #1

Hi all. I have an interesting problem. I have created a hype file that references images stored in hype resources directory. While only referenced once in the code, it makes the call in preview to the image 2 times, finding it once and not finding it the other time and that errors my code. Here is my code:
if (djiData.pt.indexOf("+") > -1 ) {
document.getElementById(“dowArrow1”).innerHTML = ‘reference to image tag UpArrow’;}
else {
document.getElementById(“dowArrow1”).innerHTML = ‘reference to image tag DownArrow’;}

In troubleshooting, I found that the extra image reference goes away if I remove the “.innerHTML”…but then the image won’t display. Help!


(Mark Hunte) #2

Hi can you post the project


(Joyce Vogt) #3

Thank you!!! I’m stumped. Short of starting over with my Hype document, I have no idea how to fix.


(Joyce Vogt) #4

So, I have also found I have a filenaming/ directory path problem with my files. I’m learning…no spaces!! I’m not sure if this is related to my problem here, but I just thought I would toss that out there.

Thanks.


(Mark Hunte) #5

Hi,

I am not sure why you change the directory paths to:

 document.getElementById("dowArrow").innerHTML = '<img src = "2_Financials_Major_Indices_Previous_Close.hyperesources/arrowup.png">';} 
  		  else {
 document.getElementById("dowArrow").innerHTML = '<img src = "2_Financials_Major_Indices_Previous_Close.hyperesources/arrowdown.png">';}

They should stay the same as in your first project.

     if (djiData.pt.indexOf("+") > -1 ) {
document.getElementById("dowArrow").innerHTML = '<img src = "${resourcesFolderName}/arrowup.png">';} 
      		  else {
document.getElementById("dowArrow").innerHTML = '<img src = "${resourcesFolderName}/arrowdown.png">';}

This will then point to the correct resources Folder.

2_Financials_Major_Indices_Previous_Close.hype.zip (297.3 KB)


(Joyce Vogt) #6

Thank you! This was helpful. I’m not sure how the img src directory changed. I appreciate your help!