42 users online (1 members and 41 guests)  


Page 1 of 2 1 2 Last
  Results 1 to 15 of 16

Related

  1. Replies: 0
  2. input help    Forum: HTML Forum
    Replies: 1
  3. HTML Form input types    Forum: HTML Forum
    Replies: 3
  1. #1
    RF2OOO's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Aug 2010
    Posts
    30

    Smile HTML input question, how do I add an input field to a single URL?

    I have a quick question, I couldn't find anywhere that shows how to use an input to add text to a single URL, or if that's even possible. Any suggestions? Thanks, it's greatly appreciated!!

    My example:

    I have a url, I want to add an input table to set the value @ the end of the URL.

    http://www.example.com/?=event_actio...0%desiredname=

    I want to add an input field so that I can add a name to the field, and have it post the url with the added name so it looks like this after the input:

    http://www.example.com/?=event_actio...=NameUsedValue

  2. #2
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: HTML input question, how do I add an input field to a single URL?

    Hi there RF2OOO,

    does this basic example help in any way?

    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    
    <title></title>
    
    <style type="text/css"></style>
    
    <script type="text/javascript">
    
    function init(){
    
       df=document.forms[0];
       df[0].focus();
       df[1].onclick=function() {
    if(df[0].value=='') {
       alert('please enter desired name in the box');
       df[0].focus();
       return;
     }
    
       modifiedUrl='http://www.example.com/?=event_action=yaddayaddayadda&amp;desiredname='+df[0].value;
    
       alert(modifiedUrl);   /* this line may be removed */
    
       location.href=modifiedUrl; 
      }
     }
    
    if(window.addEventListener){
       window.addEventListener('load',init,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',init);
      }
     }
    </script>
    
    </head>
    <body>
    
    <form action="#">
    <div>
     <input type="text">
     <input type="button" value="add text to a url">
    </div>
    </form>
    
    </body>
    </html>
    

  3. #3
    RF2OOO's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Aug 2010
    Posts
    30

    Re: HTML input question, how do I add an input field to a single URL?

    Thanks sooo much Coothead, and yes it totally helps, and I'm very appreciative of it. I have always had trouble understanding some of the more complex functions of building a website. Things like design CSS, HTML, and such, I usually have learned fairly quickly. Other things like Java have been much harder.

    Everywhere I looked for an answer to form type submission basically was the same, which is something like this:

    <input inputname inputid something.php actionPost/Get>

    That's not exactly how it should be but that's an example to show how I interpreted it as. lol I know there are no easy answers when it comes to computers, as many things these days are quite intricate.

    Thanks for your help! Your example has given me a framework from which I now understand it a whole lot more.

  4. #4
    RF2OOO's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Aug 2010
    Posts
    30

    Re: HTML input question, how do I add an input field to a single URL?

    I got it!!! yaaay, I just had to learn more about inputs in html and java. Thanks for the help! I have to rewrite it to clean up my code though. I'll post it when it's done.
    Last edited by RF2OOO; 09-01-2010 at 06:41 PM.

  5. #5
    RF2OOO's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Aug 2010
    Posts
    30

    Re: HTML input question, how do I add an input field to a single URL?

    Thanks again Coothead, your code actually worked better than the one I wrote, unfortunately though, people were changing their names to to clone other people, and basically taking advantage of it, so it was removed. I do appreciate it though, and am using this code elsewhere as it's totally helpful. It is a way to add text to a url, and submit it but without PHP, which I assumed was easy, however I now know it's not, lol.

    Thanks to you man, I'm sure this also helps hundreds if not thousands of others with the same question, as indicated by the number of hits this topic got. I'm surprised it got as many as it did lol. Right on man, I owe you one.

    note: To anyone that also found this useful, you might want to join if you haven't already, trust me, it's worth the 2 mins it takes to sign up.

    Here's Coot's code, with all the areas labeled for anyone that needs help understanding it, be sure to thank him if you use it.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    
    <html lang="en">
    
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    
    
    
    <title>
    <<<<<<<<<<<Page title goes here>>>>>>>>>>>>
    </title>
    
    
    
    <style type="text/css">
    <<<<<<<<Page design CSS goes here>>>>>>>>>
    </style>
    
    
    
    
    <script type="text/javascript">
    //Adding custom text onto a url, courtesy of CootHead, you rock man!!!
    function init(){
    
       df=document.forms[0];
       df[0].focus();
       df[1].onclick=function() {
    if(df[0].value=='') {
       alert('<<<<<<<<<Custom pop-up error message goes here>>>>>>>>>');
       df[0].focus();
       return;
     }
    
       modifiedUrl='<<<<<<Website Goes Here>>>>>>>>'+df[0].value;
    
       alert(modifiedUrl);   /* this line may be removed */
    
       location.href=modifiedUrl; 
      }
     }
    
    if(window.addEventListener){
       window.addEventListener('load',init,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',init);
      }
     }
    </script>
    
    </head>
    
    
    <body>
    <form action="#">
    <div>
     <input type="text">
     <input type="button" value="Button label goes here">
    </div>
    </form>
    </body>
    
    </html>

  6. #6
    yoursitessuccess's Avatar
    New User

    Status
    Offline
    Join Date
    May 2012
    Location
    Queensland
    Posts
    8

    Re: HTML input question, how do I add an input field to a single URL?

    I agree with RF2OOO completely, Coothead, this code was not only very useful but it was also very very very hard to find, I have spent endless hour searching for something like this and found it on page 4 of google Why is it all the way on page 4!!!

    I have a further question on this code, I wanted to use this code to help people add their 'whois' style site.

    the question I have is, am I able to use the input for serveral sites to open in new pages or timed for it to use the input to go from website to website.

    I hope you understand what I mean.

  7. #7
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: HTML input question, how do I add an input field to a single URL?

    Hi there yoursitessuccess,

    and a warm welcome to these forums.

    To have multiple windows open, instead of the one, would not allow us to use the "location.href" method.

    The "window.open()" method will work, but probably not for those with pop-up blockers installed.

    Anyway here is the code for you to try...
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    
    <title></title>
    
    <style type="text/css"></style>
    
    <script type="text/javascript">
    
    function init(){
       urls=[                                                /* add any number of addresses */
             'http://www.bing.com/search?q=',
             'http://www.google.co.uk/search?q=',
             'http://search.yahoo.com/search?ei=utf-8&p='     /* no trailing comma after last item */
            ]
       modifiedUrl=[];
       df=document.forms[0];
       df[0].focus();
    
       df[1].onclick=function() {
    if(df[0].value=='') {
       alert('please enter desired name in the box');
       df[0].focus();
       return;
     }
    
    for(c=0;c<urls.length;c++){
    
       modifiedUrl[c]=urls[c]+df[0].value;
    
       window.open(modifiedUrl[c]);
    
       }
      }
     }
       window.addEventListener?
       window.addEventListener('load',init,false):
       window.attachEvent('onload',init);
    
    </script>
    
    </head>
    <body>
    
    <form action="#">
    <div>
     <input type="text">
     <input type="button" value="add text to a url">
    </div>
    </form>
    
    </body>
    </html>
    

  8. #8
    yoursitessuccess's Avatar
    New User

    Status
    Offline
    Join Date
    May 2012
    Location
    Queensland
    Posts
    8

    Re: HTML input question, how do I add an input field to a single URL?

    Coothead mate! This is prefect, exactly what I wanted, You are unreal. Before I found this forum, I was told on another forum that it couldn't be done without PHP.
    But you have shown me the light and now I can read and learn, I love it. I'll defniately be looking further around these forums and be giving a G+1
    Thankyou so much!

    I have to do a little work on the code but once I have fully completed it I will let you know.

    Thanks again.

  9. #9
    yoursitessuccess's Avatar
    New User

    Status
    Offline
    Join Date
    May 2012
    Location
    Queensland
    Posts
    8

    Re: HTML input question, how do I add an input field to a single URL?

    1 further question, I tried looking around to be able to work it out myself but well what I put in didn't work.
    Am I able to either: put a delay inbetween every 10 urls opening
    or: put a delay between opening each url and open them all in the same window instead of in seperate windows.

  10. #10
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: HTML input question, how do I add an input field to a single URL?

    Hi there yoursitessuccess,

    as I said in my previous post...
    To have multiple windows open, instead of the one, would not allow us to use the "location.href" method.
    This means that it will only work in separate windows.

    The delay between each url can be achieved though ...
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    
    <title></title>
    
    <style type="text/css"></style>
    
    <script type="text/javascript">
    
    function init(){
       delay=10000;                                          /* this is set to 10 seconds, change value to suit */
       urls=[                                                /* add any number of addresses */
             'http://www.bing.com/search?q=',
             'http://www.google.co.uk/search?q=',
             'http://search.yahoo.com/search?ei=utf-8&p='     /* no trailing comma after last item */
            ]
       modifiedUrl=[];
       k=0;
       mywindow=null;
       df=document.forms[0];
       df[0].focus();
    
       df[1].onclick=function() {
    if(df[0].value=='') {
       alert('please enter desired name in the box');
       df[0].focus();
       return;
     }
    
    for(c=0;c<urls.length;c++){
       modifiedUrl[c]=urls[c]+df[0].value;      
       }
       gothere();
      }
     }
    function gothere(){
    if(mywindow) {
       mywindow.close();
     }
       mywindow=window.open(modifiedUrl[k]);
    
    if(k!=urls.length-1) {
       setTimeout(function(){k++;gothere()},delay);
      }
     }
       window.addEventListener?
       window.addEventListener('load',init,false):
       window.attachEvent('onload',init);
    
    </script>
    
    </head>
    <body>
    
    <form action="#">
    <div>
     <input type="text">
     <input type="button" value="add text to a url">
    </div>
    </form>
    
    </body>
    </html>
    
    Last edited by coothead; 05-17-2012 at 04:15 AM. Reason: spelling mistake / "Senior Moment"

  11. #11
    yoursitessuccess's Avatar
    New User

    Status
    Offline
    Join Date
    May 2012
    Location
    Queensland
    Posts
    8

    Thumbs up Re: HTML input question, how do I add an input field to a single URL?

    both codes worked perfect for what i need! The second one is a little better for the amount of urls I am opening but I love both and will be studying them to help me learn more javascript. Thankyou so much! If i can ever repay you, just let me know.

  12. #12
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: HTML input question, how do I add an input field to a single URL?

    No problem, you're very welcome.
    Helping others along the way is reward enough.

  13. #13
    yoursitessuccess's Avatar
    New User

    Status
    Offline
    Join Date
    May 2012
    Location
    Queensland
    Posts
    8

    Re: HTML input question, how do I add an input field to a single URL?

    It did take a little bit of time for me to fully complete it and I had to do some other work on it aswell, changed my mind a few times, but hey thats what I do... create twice as much work for myself... but I finished what I wanted to do. Thanks again coothead, here is the result of the tool I wanted to create with the code you gave me, yoursitessuccess.com/backlink-tool.html

  14. #14
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: HTML input question, how do I add an input field to a single URL?

    Hi there yoursitessuccess,

    I assume that you want visitors to your page to "C&P" the code that you have placed within the "textarea element".

    With the "No right click script" that you have also installed, this will be impossible for the uninitiated to achieve.

  15. #15
    yoursitessuccess's Avatar
    New User

    Status
    Offline
    Join Date
    May 2012
    Location
    Queensland
    Posts
    8

    Re: HTML input question, how do I add an input field to a single URL?

    Yea, I don't intend to send visitors to that page, I actually have it dispalyed on another page of my site where they are able to right click.



Page 1 of 2 1 2 Last

Tags for this Thread