www.webdeveloper.com
Results 1 to 12 of 12

Thread: Paste link feed

  1. #1
    Join Date
    Dec 2009
    Posts
    92

    Paste link feed

    Hi all,

    I have a feed which consist out of links. When I click on a link obviously it will take me to the href of that link.But instead of doing that I want to make the link(the words actualy) to be placed inside a text box (form). They must do this on click.

    Thank you

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Code:
    <input type="text" readonly="readonly" value="http://www.google.com" onclick="location.href=this.value">

  3. #3
    Join Date
    Dec 2009
    Posts
    92
    Apparently I wasn't clear. The (feed) links are outside the text box. They are generated by feedburner like this:
    Code:
    <script src="http://feeds.feedburner.com/google/PkvF?format=sigpro" type="text/javascript" ></script>
    The feed is in fact a list of links('popular searches by google'). Clicking a link will take you to the href. Instead of this default behouver I want the link to appear(/onClick) as words(plain html/text) in a text box. Hope I made my self clear this time.

  4. #4
    Join Date
    Dec 2009
    Posts
    92
    Oke guys,

    What if I target all links on the html page with js and then give a function to place the links as plain text in a text box by onclick method. My only question: How do I do that?

  5. #5
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    If you want more than one link in a text field or textarea field, there is not any way that I can think of that will allow you to click ONE of those URLs and go to that URL. If you want the ability to click just one of several links, do not put them all into the same element; put each one in its own element and set the onclick parameter to go to that link.

    OR put them all into a WYSIWYG editor, disable the ability to change the content, and parse HTML. That might work.

    ^_^

  6. #6
    Join Date
    Dec 2009
    Posts
    92
    @WolfShade,

    I seriously don't understand what you are talking about.
    Whatever it is, it has nothing to do with my problem.

  7. #7
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by yomoore View Post
    @WolfShade,

    I seriously don't understand what you are talking about.
    Whatever it is, it has nothing to do with my problem.
    Nor do we understand what you are talking about. Will you be so kind and explain in plain words what is your problem?

  8. #8
    Join Date
    Dec 2009
    Posts
    92
    Quote Originally Posted by Kor View Post
    Nor do we understand what you are talking about. Will you be so kind and explain in plain words what is your problem?
    I have a feed wich is generated by feedburner. It looks like this:

    Code:
    <script src="http://feeds.feedburner.com/google/PkvF?format=sigpro" type="text/javascript" ></script>
    If you copy/paste this in the body section you wil see a list of popular searches provided by google. These popular searches are also href's , so the feed looks like this in my browser:

    popular search 1
    popular search 2
    popular search 3
    popular search 4
    etc.


    So when clicking on a link this action wil take you to the href of that link wich is a google website. Instead of this default behouver I would like that these popular searches to be placed inside a text box when they are clicked.

    So this wil happen:

    1.Empty text box
    2.click on popular search 3 (or whatever)
    3. Popular search 3 will be placed in the text box (the inner html NOT the href)
    4. Text box is now showing the text ''Popular search 3''

    I realy hope somebody would give me a clue about this. I can make the links dead but than they are not clickeble anymore.

  9. #9
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Like this?:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <script type="text/javascript">
    onload=function(){
     var allA=document.getElementById('mylinks').getElementsByTagName('a'), a, i=0;
     while(a=allA[i++]){
     	a.onclick=function(){writeInField(this.href);return false}
     }
    }
    function writeInField(thislink){
    var field=document.getElementById('txtid');
    field.value=thislink;
    }
    </script>
    </head>
    <body>
    <div id="mylinks">
    <a href="http://www.google.com">Google</a>
    <br>
    <a href="http://www.yahoo.com">Yahoo</a>
    <br>
    <a href="http://www.bing.com">Bing</a>
    </div>
    <form action="">
    <input type="text" name="txt" id="txtid">
    </form>
    </body>
    </html>

  10. #10
    Join Date
    Dec 2009
    Posts
    92
    Yes @Kor, like that. Exept I need the innerhtml to be fild in. I need the bold letters inside the text box, not the href:

    <a href="http://www.google.com">Google</a>

    I search the internet but can't find anything since this is a unique situation.
    Last edited by yomoore; 02-11-2011 at 06:51 AM.

  11. #11
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by yomoore View Post
    Yes @Kor, like that. Exept I need the innerhtml to be fild in. I need the bold letters inside the text box, not the href:

    <a href="http://www.google.com">Google</a>
    Code:
    while(a=allA[i++]){
     	a.onclick=function(){writeInField(this.firstChild.nodeValue);return false}
     }

  12. #12
    Join Date
    Dec 2009
    Posts
    92
    From now on I will reject my religion and worship the greatness that is Kor.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles