Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Complicated HTML Problem
#11
(12-19-2009, 02:49 PM)Master of The Universe Wrote: Ajax would do it, http://www.w3schools.com/Ajax/Default.Asp

Could you give me an example of some code I would use?
Robert Picard
http://www.rpicard.net
#12
(12-19-2009, 03:08 PM)Rob Wrote: Could you give me an example of some code I would use?

So here you go, there is a php script that loads the content of a given website, in this case it's a google.com

PHP Code:
<?php

$content 
file_get_contents("http://www.google.com/");

$matches null;

preg_match_all("/<title>(.*?)<\/title>/"$content$matches);

echo 
$matches[1][0];

?>

The preg_match function will search for the title of the loaded content and it will echo it
Now the ajax, the code is taken from w3 and I edited few lines...

Code:
<html>
<body>

<script type="text/javascript">
function ajaxFunction()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
  document.getElementById("content").innerHTML=xmlhttp.responseText;
  }
}
xmlhttp.open("GET","extern.php",true);
xmlhttp.send(null);
}
</script>

<div id="content" onclick="ajaxFunction();">
a
</div>

</body>
</html>


When you click on the div, the ajaxFunction will load extern.php.... and update the inner html of the div.
#13
(12-19-2009, 03:14 PM)Master of The Universe Wrote: reserving a place... just a sec

Sorry to go a little off topic here, but, @ MotU, "reserving a place....just a sec." Lol.
Do you know how to make games? Do you know 3d Modeling? If so then visit
[Image: logo.png]
#14
(12-19-2009, 03:14 PM)Master of The Universe Wrote: reserving a place... just a sec

Okay thanks.
(12-19-2009, 03:15 PM)Grizzly Wrote: Sorry to go a little off topic here, but, @ MotU, "reserving a place....just a sec." Lol.

Well I guess he was letting me know that he was working on it. I appreciate the heads up.
Robert Picard
http://www.rpicard.net
#15
Yeah, I didn't mean to disappear on you like that. I had to take my wife to the hospital a couple hours ago because she has appendicitis and I was on the phone with her while she was letting me know what the doc's said. But, he appears to have it all under control.
Do you know how to make games? Do you know 3d Modeling? If so then visit
[Image: logo.png]
#16
(12-19-2009, 03:33 PM)Grizzly Wrote: Yeah, I didn't mean to disappear on you like that. I had to take my wife to the hospital a couple hours ago because she has appendicitis and I was on the phone with her while she was letting me know what the doc's said. But, he appears to have it all under control.

Oh sorry to hear that. Glad everything's under control though.
Robert Picard
http://www.rpicard.net
#17
(12-19-2009, 03:15 PM)Grizzly Wrote: Sorry to go a little off topic here, but, @ MotU, "reserving a place....just a sec." Lol.

Yeah lol it didn't went as I thought, I needed a min to edit that post, but I had to go to, so I couldn't update it....
But we want to have quality posts, so I updated it now...
It's 05:47am now and I'm finally home tired as hell

I'm sorry too for disappearing...
#18
are you trying to include a whole page(text file/html/etc) into an area?

use this http://www.hackforums.net/showthread.php?tid=99831
#19
Thanks for the help guys, I don't think this is going to work out as I wanted though.
Robert Picard
http://www.rpicard.net


Possibly Related Threads…
Thread Author Replies Views Last Post
  Contact form for HTML Crystal 36 10,933 05-24-2013, 05:51 PM
Last Post: Akai
  Helping with HTML and CSS Ambitious 0 697 08-28-2011, 01:18 PM
Last Post: Ambitious
  Anyone have any free HTML resources? Scalise 7 1,771 06-01-2011, 04:00 AM
Last Post: !LoL
  Mr. Doob :: HTML 5 Examples Gaijin 10 2,572 02-17-2011, 12:33 AM
Last Post: Gaijin
  My first HTML / CSS project. Jordan L. 11 1,707 04-09-2010, 09:44 AM
Last Post: Jordan L.

Forum Jump:


Users browsing this thread: 3 Guest(s)