HTML coding help

choozay

Solid State Member
Messages
18
Hello,

Wandering if any one could help me with a quick coding issue.:)

Is there a way of using the html tag <a href> in a .txt file, i knw u can use the <b> tags in a txt file, but i'm having a problem in using the <a href> tag!! :eek:

For some reason at my work place they have a .txt file linking in to a HTML page. I need to add a link on the .txt file to point to a pdf file.

Cheers..:D
 
I guess the question is what are you using as a text editor. Depending on the program in use, you may be able to put a hyperlink in the txt document.

If you are talking about creating a file in notepad, naming it something.txt and you want to put a hyperlink in there that you can click on in notepad, it's not going to work because you will have no formatting at all in notepad, it's completely plain text.
 
choozy,

why don't you just post a link to the pdf file in the html. Then it will just show up on the website, and they can bypass the text file altogether. As far as I know you can't put a link in a text file.

Cheers!
 
ksb007 - I aint using no software, all being done by code. Well im not adding a hyperlink, im trying to code in a link to some documents on our webserver, I want to know if you could do this in a .txt file.

wmorri - I would if i could, for some reason, they have got a HTML, all txt within that HTML is being read from a seprerat .txt file. So i have to insert the link within that txt file. :confused:.

I knw they are using .asp Would this effect anything??

Cheers ! ! ! :D
 
If the text for the HTML document is coming from a txt file, just include the tags for the hyperlink <a href></a> within the text file.

Then create something like a label or just use a <div> element and set the innerHTML as the text from the txt file.

<html>
<head>
<title>
</title>
<script type="text/javascript">
function setHTML()
{
document.getElementById("test").innerHTML = "<a href='http://computerforums.org'>This should work</a>"
}
</script>
</head>
<body>
<input type="button" onClick="setHTML();">
<div id="test"></div>
</body>
</html>

Above is a simple example but when you click the button, the link will appear. Instead of putting the link, in the innerHTML just replace it with the text from the txt file..
 
KSB007 you lost me after your first sentance..lol..

Im kinda of new to HTML coding, what do you mean by create a label?? Would the code you gave go in to the HTML file that is reading from the .txt file or in the .txt file its self??

Sorry for my lack of knowledge dude..

Cheers..
 
Unfortunately, you are working with custom code. It sounds like whatever you're working on is an asp document that reads in a text file for it's content. If this is the case, you should be able to put the hyperlink right in the text document, and the asp will import the text document and output it as html.
If it doesn't do this, one of two things are happening:
1.) The asp script is specifically weeding out hyperlinks (as a validation).
2.) The code has an error, or is not supposed to read html at all.

In either case, we could better help you if we saw both the text file and the asp page.

Hope this helps.

ksb007's solution should work. Basically what that means is to instead of a hyperlink in the text document, replace it with a <div> element that looks like this:
Code:
<div id="test">
</div>
The javascript will then replace that with a hyperlink. It should be noted that if this is for a website, a search engine will not be able to read this javascript link.
 
Back
Top Bottom