+ Reply to Thread
Results 1 to 9 of 9

Thread: Iframe src= URL + text field

  1. #1
    gaptrast's Avatar
    gaptrast is offline x10 Sophmore gaptrast is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    117

    Unhappy Iframe src= URL + text field

    Hello I need to get the iframes to load a page + letters from a text field:fart:


    Here is an example site:
    Code:
    Put you youtube username here and the box below will show your youtube site and facebooksite.
    
    
    {here is a text field)
    
    
    <input ???> Sumbit
    <br>
    <br>
    
    <iframe type="hidden" width="100%" lenght="100%" src= http://www.youtube.com/user/ + text field>
    
    <iframe type="hidden" width="100%" lenght="100%" src= http://www.facebook.com/ + text field>
    I do not know if it works with facebook but this was just an example.

    I need help to the src= http://www.youtube.com/user/ + text field> (look in the first iframe) To load the youtube.com + the letters in the text field. It could be:

    http://www.youtube.com/user/bombmakingak and
    http://www.facebook.com/bombmaking.ak (this is examples)

  2. #2
    drf1229 is offline x10Hosting Member drf1229 is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    71

    Re: Iframe src= URL + text field

    You need to be more specific. What language do you want to use? PHP, ASP, Javascript, etc.
    Server side languages like PHP and ASP may not be the best because they will reload the page.
    Javascript will allow you to make changes without reloading the page, which might be what you are looking for. Try http://www.w3schools.com for tutorials on these languages.
    Your 14 year old web developer. If I can do it, you can!
    My site
    My iPhone App

  3. #3
    gaptrast's Avatar
    gaptrast is offline x10 Sophmore gaptrast is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    117

    Exclamation Re: Iframe src= URL + text field

    It is the same for me but i like best javascript:dunno:. If something better work I can use that;)

  4. #4
    drf1229 is offline x10Hosting Member drf1229 is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    71

    Re: Iframe src= URL + text field

    Well if you like javascript, the task you want can easily be accomplished with that language. Just read the tutorials and you'll be able to do it.
    Your 14 year old web developer. If I can do it, you can!
    My site
    My iPhone App

  5. #5
    gaptrast's Avatar
    gaptrast is offline x10 Sophmore gaptrast is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    117

    Question Re: Iframe src= URL + text field

    ok sorry, I did not find things about this in the toturials. It is not so easy for me, I am 12 and my language is not english. Can you tell me some more about it.

    Thanks:lockd:

  6. #6
    drf1229 is offline x10Hosting Member drf1229 is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    71

    Re: Iframe src= URL + text field

    ok, well i'm only 14. A little javascript that does something like that looks like this:

    PHP Code:
    <form>
    <
    input type="text"  id="yourtextfield"/>
    <
    input type="button" onclick="submit();"/>
    </
    form>
    <
    iframe id="youriframe"></iframe>
    <
    script type="text/javascript">
    function 
    submit(){


    document.getElementById("youriframe").src="http://www.youtube.com/"+document.getElementById("yourtextfield").text;


    }
    </script> 
    This may look a bit complicated but I'll be happy to explain anything you don't understand.
    Last edited by drf1229; 01-09-2010 at 11:10 AM.
    Your 14 year old web developer. If I can do it, you can!
    My site
    My iPhone App

  7. #7
    gaptrast's Avatar
    gaptrast is offline x10 Sophmore gaptrast is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    117

    Thumbs down Re: Iframe src= URL + text field

    sorry, but it did not work. Try self! Do i need to write more than just the code?

  8. #8
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Iframe src= URL + text field

    HTML Code:
    <html>
    <head>
    <title>iFrame Test</title>
    
    <style type="text/css">
    
     #youriframe { height: 400px ; width: 500px; }
    
    </style>
    
    <script type="text/javascript">
    
    function go_get(){
      var base_url = 'http://forums.x10hosting.com/members/' ;
      var usr_name = document.getElementById("yourtextfield").value ;
      var target_url = base_url + usr_name + ".html" ;
      var ifr = document.getElementById( "youriframe" ) ;
      ifr.src = target_url ;
     return false ;
    }
    
    </script> 
    
    </head>
    
    <body>
    
    <form onsubmit= ="go_get(); return false;" >
    <input type="text"  id="yourtextfield"/><br/>
    <input type="submit" value="Get member page" />
    </form>
    <iframe id="youriframe" ></iframe>
    
    </body>
    </html>
    Type in a x10 forum name and see their member page (doesn't work with names with special characters, etc)
    Last edited by descalzo; 01-09-2010 at 12:36 PM.
    Nothing is always absolutely so.

  9. #9
    gaptrast's Avatar
    gaptrast is offline x10 Sophmore gaptrast is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    117

    Cool Re: Iframe src= URL + text field

    Thanks to everyone, but descalzo I found a bug on your code:
    Code:
     form onsumbit= =" ..
    Last edited by gaptrast; 01-10-2010 at 11:19 AM. Reason: forgot something

+ Reply to Thread

Similar Threads

  1. Hybrid's HTML Lessons
    By Hybrid in forum Tutorials
    Replies: 18
    Last Post: 11-28-2009, 02:12 PM
  2. html/css help
    By swantonbomb88 in forum Programming Help
    Replies: 3
    Last Post: 05-01-2008, 09:12 AM
  3. BB Code Guide
    By Jober68 in forum Tutorials
    Replies: 1
    Last Post: 01-10-2008, 05:12 PM
  4. What is Authentication
    By asadislam78 in forum Computers & Technology
    Replies: 1
    Last Post: 12-13-2007, 07:13 AM
  5. Create a text Field during execution in flash.
    By satheesh in forum Tutorials
    Replies: 0
    Last Post: 10-20-2007, 01:49 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers