I have written a php script that generates a list of links that match certain criteria.
I want the links to open in a new browser windows with selected words highlighted in the page.
Is there an easy way to do this? Note that this is for personal use only, so it can be a browser specific solution.
Edited to better answer question.
Use AJAX to load the page and then process the returned HTML.
I prefer using JQuery. Check out this tutorial for loading HTML from other pages.
http://css.dzone.com/articles/jquery-load-data-from-other-pa
After you get the data I think you can easily figure out how to parse it
The JQuery example from the link,: (not My code)
<div id="container">
<a href="#" id="loadData">Click This Link To Load My Favorite Movies</a>
</div>
$(document).ready(function()
{
$("#loadData").click(function()
{
$(this).text("...One Moment Please...");
$("#container").append('<div id="favoriteMovies"></div>')
.children("#favoriteMovies").hide()
.load("theOtherPage.htm ul#favoriteMovies", function()
{
$("#loadData").remove();
$("#favoriteMovies").slideDown("slow");
});
return false;
});
});
The page being loaded:
<ul id="favoriteMovies">
<li style="font-weight: bold; list-style-type: none;">My Favorite Movies</li>
<li>Contact</li>
<li>Shawshank Redemption</li>
<li>Napoleon Dynamite</li>
<li>Back To The Future</li>
<li>The Goonies</li>
<li>Cinderella Man</li>
<li>Apollo 13</li>
</ul>
Note: please somebody let me know if I should not post code from another site, but instead only post a link. I do not wish to anger anyone. thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With