-2

I'm writing an application, a reporter with heirarchy of folders and files, in the lower heirarchy level there are 2 types of reports: the simple one is a flat (non link) report that being presented as a single simple line. the second type is a link with a general description in the header and if you press the link you get a full report.

example: if I run a telnet command, I will see the command in the header and if I want to see the entire session with the device I will press the link and it will be presented.

My problem is that most of this lined-files are small but the OS reserve a minimum space for every file so I loss alot of disk space for nothing. The solution I want to implement is a "dummy" links, which will be presented and will behave like a regular links but actually will be stored in the same file like their "parent" (probably with alot of other links like them).

The solutions I saw so far are only for "jumping" inside a page but this is not what I'm looking for, I want it to be presented like a seperated file and I dont want the "parent" file to present this information at all (the only way to see it will be by pressing the link and even then it will present only this information and not the other file content).

any idea guys?

Hovav
  • 151
  • 2
  • 13

1 Answers1

1

To link to a specific part in a web page, place an anchor link where you want the user to go to when they click a link with:

<a name="anchor"></a>

and link to it with:

Click <a href="#anchor">here</a>

You can replace "anchor" with a more descriptive name if needed.


To hide/show a div (the following code is untested, but should work)

JQuery solution (If you're using JQuery):

function toggle(divname) {
    $(divname).toggle();
}

The corresponding HTML:

<div id="content">some content</div>
<a onclick="toggle('content')">Click here to show/hide the content div!</a>

Non-JQuery Solution:

function toggle(divname) {
    var adiv = document.getElementById(divname);
    if (adiv.style.display === 'block' || adiv.style.display === '') {
        adiv.style.display = 'none'; 
    } else {
        adiv.style.display = 'block'
    }
}

The HTML:

<div style="display:hidden" id="content">Content</div>
<a onclick="toggle('content')">Click here to show/hide the content div!</a>
Mythrillic
  • 417
  • 1
  • 6
  • 16