Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: .txt to display in tooltip?  (Read 3007 times)

0 Members and 1 Guest are viewing this topic.

tooNewBlue

    Topic Starter


    Starter

    .txt to display in tooltip?
    « on: July 07, 2010, 10:32:12 AM »
    I have a feeling this is a simply answer but it never hurts to make sure. I do not want to have to re-write the info in each .txt file i have to correspond to each of my store images. i was thinking re-save them all as .html but then i would still have to open each one so might as well just copy and paste to the google spreadsheet.

    oh wait what is it javascript or css that would allow me to reference the .txt file to show its content in the tooltip below the enlarged image?

    kpac

    • Web moderator
    • Moderator


    • Hacker

    • kpac®
    • Thanked: 184
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: .txt to display in tooltip?
    « Reply #1 on: July 07, 2010, 01:04:50 PM »
    Javascript can do it.

    Code: [Select]
    var txtFile = new XMLHttpRequest();
    txtFile.open("GET", "http://www.mywebsite.com/textfile.txt", true);
    txtFile.onreadystatechange = function() {
      if(txtFile.readyState === 4) {
        if(txtFile.status === 200) {
          allText = txtFile.responseText;
          lines = txtFile.responseText.split("\n");
        }
      }
    }
    txtFile.send(null);

    The variable "allText" is what you want to use.
    « Last Edit: July 08, 2010, 02:50:21 AM by kpac »