link html

F

fridayteam

I am currently working on link exchanges with my site.

Someone somewhere [and I now can't find it] put a suggested way of offering html code to your link exchanges.

If anyone knows what I am talking about, if you could post the html here that would be fantastic!
 
Hi,

I am not sure what you are asking.

Is it, "how do I offer the html code that people should use to link to my site?"

You have already done that at the bottom of your post.

Perhaps you mean broader links management?

Personally. I installed a links management php program onto my site to manage all of this for me. I used wsnlinks. This is a licensed product, around $60 for a perpetual license, and requires MYSQL and PHP hosting.

Stuart
 
Upvote 0
There's is nothing clever about that. If you look at the source code you will be able to see how to reproduce it for your own requirements. The fact that it happens to be a php file (originally - what you see, and what the source shows you, is the resultant html after php processing).

The key bits are:
Code:
[url="javascript:HighlightAll('mylink.set1')"]Select & Copy[/url]
to call the javascript code that does the copy for you

and

Code:
<textarea class="no" name="set1" rows="4" cols="65" >[url="http&#58;//www.fridayteam.com/"][img]http&#58;//www.fridayteam.com/images/FRI001LOG100.jpg[/img][/url]</textarea>
for the area you want to copy.

These two blocks need to be inside a form. The form names needs to match that referenced in the call to the javascript code. I used mylink.

You have as many of these pairs of blocks inside the form as you require. You need to match the name of each pair of blocks (i.e. the bit after mylinks in the javascipt call to the name of the text area) - I used set1 for this first pair.

The javascript is pretty standard. Their site uses:
Code:
function HighlightAll&#40;theField&#41; &#123;
var tempval=eval&#40;"document."+theField&#41;
tempval.focus&#40;&#41;
tempval.select&#40;&#41;
if &#40;document.all&&copytoclip==1&#41;&#123;
therange=tempval.createTextRange&#40;&#41;
therange.execCommand&#40;"Copy"&#41;
window.status="Contents highlighted and copied to clipboard!"
setTimeout&#40;"window.status=''",1800&#41;
&#125;
&#125;

Stuart
 
Upvote 0
Ravenfire said:
Oh yikes sorry dont really understand that
Which bit? If none of it, then you need someone to do this for you.

Go back to the website in question and select view source on your web browser then save the text file you are looking at. Load it up in a text editor (NOT a word processor) and look at it to find the bits I pointed out.

Do the same thing with one of your own standard web pages and save it as a new page, eg. mylinks.htm.

Now, you just put the bits you need into your page under other content (above the closing </body> code).

You can ignore most of the stuff in "his" page accept the bits I mentioned which I will now explain.

Select &amp; Copy Is used to call the javascript code that does the copy for you.

You should recognise the <a bit as what we use to link to somewhere else as described used earlier to address the original reason for this post. Instead of linking to another website/page, this time it is used to call some javascript program code. You do not need to understand the javascript in any detail.

The bit of javascript that is run is called HighlightAll and each time it is asked to run, it is told which bit of text of the page is required to be copied. This is the ('mylink.set1') which ties in with the bit of text in the <textarea. Each text area has a name, e.g. name="set1".

Inside the text area (between <textarea ....> and </textarea>) is the link code like the examples given earlier in this thread.

So, you put the two blocks of code I gave you inside a form block:

<form name="mylin">
the blocks I gave you
repeat the blocks but change set1 to set2, set3, etc for each pair
</form>

That's everything for the body section of your webpage.

The usual place to put the javascript is inside the head section of the document. (between <head> and </head>). Where he has <script type="text/javascript" src="abc.js"></script> you can place the actual script between the <script ...> and </scipt> and lose the src="abc.js" bit - which was the name of the file he has the script in instread of including it in the page itself.

Does that help?

Stuart
 
Upvote 0
Here you go, here is a complete and very plain example (including a line I had missed out of the top of the Javascript).

By the way, this uses the javascript execCommand which is only supported in Microsoft Internet Explorer. Off the top of my head I do not know of a standard way of doing this. Perhaps someone else does. Last time I checked copying things to the clipboard was considered an insecure thing for a browser to do and could only be done on Firefox using "signed scripts" which you tend to only see within companies.

Normally I go with standards.... your choice.

Stuart
 
Upvote 0
Firefox;

Code:
<script language="Javascript">
function doStuff&#40;&#41; &#123;
	nLength = document.getElementById&#40;"test"&#41;.value.length;

	document.getElementById&#40;"test"&#41;.setSelectionRange&#40;0,nLength&#41;;
	return;
&#125;
</script>

[url="Javascript&#58;doStuff&#40;&#41;;"]This is a ...[/url]

<textarea id="test">This is a test</textarea>

Can't remember the clipboard code for FF, sorry :?
 
Upvote 0
My bad :p (my bad again for sounding so american)

kyber's already introduced you to <script> tags, so I'll explain as best I can;

the textarea is a simple text input, which I'm sure you are familiar with. I've put some text in it for the example. The content is highlighted when the link is clicked on;

Code:
[url="Javascript&#58;doStuff&#40;&#41;;"]This is a ...[/url]

using the href="Javascript:..." for an anchor (link) tag executes that Javascript instead of changing the page. as you can see, my function "doStuff" gets the length of the textareas content with this code;

Code:
nLength = document.getElementById&#40;"test"&#41;.value.length;

'nLength' is set to a number, which is calculated by the contents of "test" being fetched and counted. We then simply tell FF to highlight (setSelectionRange) the textareas content with this code;

Code:
document.getElementById&#40;"test"&#41;.setSelectionRange&#40;0,nLength&#41;;

the '0' is the offset; how many characters from the start we want to begin. The second value, 'nLength' is, as we already know, the total length of the contents of the textarea.

If you weren't confused before, I'm sure you will be now ;)
 
Upvote 0

Latest Articles

Join UK Business Forums for free business advice