Iframe src= URL + text field

gaptrast

Member
Messages
123
Reaction score
0
Points
16
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)
 

drf1229

New Member
Messages
71
Reaction score
1
Points
0
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.
 

gaptrast

Member
Messages
123
Reaction score
0
Points
16
It is the same for me but i like best javascript:dunno:. If something better work I can use that;)
 

drf1229

New Member
Messages
71
Reaction score
1
Points
0
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.
 

gaptrast

Member
Messages
123
Reaction score
0
Points
16
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:
 

drf1229

New Member
Messages
71
Reaction score
1
Points
0
ok, well i'm only 14. A little javascript that does something like that looks like this:

PHP:
<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:

gaptrast

Member
Messages
123
Reaction score
0
Points
16
sorry, but it did not work. Try self! Do i need to write more than just the code?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
HTML:
<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:

gaptrast

Member
Messages
123
Reaction score
0
Points
16
Thanks to everyone, but descalzo I found a bug on your code:
Code:
 form onsumbit= =" ..
 
Last edited:
Top