PDA

View Full Version : anchors



ecnarongi
July 18th, 2002, 07:40 PM
is there a way to control the link of every anchor on the page. I want something like a:link { href="http://slashdot.org" } I know this code is wrong. But is there a way to do this? All help is appreciated.

Tonz
July 18th, 2002, 10:43 PM
Not sure what you want. Do you want every link to go to the same URL?

Please expand.

Tonz :cool:

oracleguy
July 18th, 2002, 11:37 PM
Originally posted by Tonz
Do you want every link to go to the same URL?


If that is the case, you could just have all the function point to a JS function. And then that function would open the url specified.

ecnarongi
July 19th, 2002, 03:16 PM
Originally posted by oracleguy


If that is the case, you could just have all the function point to a JS function. And then that function would open the url specified.

I want all links to go to same url, please explain how... I have to use css because I have a form where I am making the person type "< a >" in the textarea to make a link

head8k
July 19th, 2002, 03:34 PM
CSS is only used for layout. You cannot change the link with CSS, only the way the text appears on the page.

You could make all the links go to the same address using plain old HTML or javascript.

Please explain in a bit more detail what you are trying to do.

ecnarongi
July 19th, 2002, 03:52 PM
interesting, so I can't say

<style>
a.href { http://www.webmonkey.com }
</style>

I know this does nada, but this is what I want, where eveytime an <a> shows up on a page I get a link to webmonkey. That's all I want to do, so everytime <a>someword</a> is clicked it goes to webmonkey.

bacterozoid
July 20th, 2002, 01:50 AM
All I can really tell you is just to change all the links on your page to this:

<a href="www.webmonkey.com">someword</a>

Using JavaScript for something such as this would be pointless and possibly not even possible. If you can expand as to some reason why you can't just use normal HTML and change all the link properties then please do.

justame
July 20th, 2002, 01:39 PM
Originally posted by bacterozoid
All I can really tell you is just to change all the links on your page to this:

<a href="www.webmonkey.com">someword</a>

/me just a thinksŪ thattt s/b...
<a href="http://www.webmonkey.com">someword</a>

ecnarongi
July 22nd, 2002, 09:59 PM
OK I am grabbing information from a database and instead of having the user, the one inputting the form information, write out the anchor, ie. <a href="http://www.webmonkey.com">word</a>, I would like him or her to just write and have the code on the displaying page link the anchor... I hope that's more clear

bacterozoid
July 22nd, 2002, 10:06 PM
Well, it almost seems like you are allowing a user to create a page, and you want a link automatically put on the page that links to webmonkey.

ecnarongi
July 23rd, 2002, 02:46 PM
Originally posted by bacterozoid
Well, it almost seems like you are allowing a user to create a page, and you want a link automatically put on the page that links to webmonkey.

yip that's what I want to do, can you help me do that?

bacterozoid
July 23rd, 2002, 03:30 PM
Yes, I think I could help you...depending on what exactly you want to do. Are you wanting this to be like a web hosting service where their page is permanent? Or do you just want the user to type HTML in a box and it pops up in a window for them to see it, and only be temporary.

ecnarongi
July 23rd, 2002, 03:46 PM
let's go for the temporary one :thumbsup:

bacterozoid
July 23rd, 2002, 03:50 PM
alright, i have a code on one of my pages that does that, but i will need to see if i can modify it to include the link...gimme a bit here to see..if i cant ill just give you the code and you can ask someone else, lol.

bacterozoid
July 23rd, 2002, 04:08 PM
Go here to see it in action...minus the link branding thing.

http://www21.brinkster.com/jonshtmlhelp/previewhtml.htm

PUT THIS IN THE HEAD TAG OF YOUR DOCUMENT.


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function displayHTML(form) {
var inf = form.htmlArea.value;
win = window.open(", ", 'popup', 'toolbar = no, status = no');
win.document.write("" + inf + "");

//modify text inside of quotes below to change link properties - the \ marks ignore the quotes from interfering with the code

win.document.write("<p align=\'center\'><font size=\'1\' face=\'arial\'><a href=\"http://www.webmonkey.com\">Webmonkey</a></p>");
}
// End -->
</script>


THIS GOES WHERE YOU WANT THE TEXT BOX FOR PREVIEWING

<form>
<textarea name="htmlArea" cols=50 rows=10>
</textarea>
<br>
<input type="button" value=" Preview HTML " onclick="displayHTML(this.form)">
</form>


That should do it...

ecnarongi
July 23rd, 2002, 04:34 PM
thanks bacterozoid, but that still doesn't solve my problem :( I guess I will have to do it the long way where I write to recognise if "<a>" is in the string and if so replace it with "<a href='http://www.webmonkey.com'>" I just thought I would be able to do this with css. Thanks for all your help. :D