You can load the contents of a page inside an HTML layer element using AJAX with this function. The url parameter can accept querystrings of dynamic pages.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
function get_content(url, div_id) { var req; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req != undefined) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if req is "loaded" if (req.status == 200) { // only if "OK" document.getElementById(div_id).innerHTML = req.responseText; } } }; req.open("GET", url, true); req.send(""); } } |
Wow, I just read today that China has announced it would indefinitely postpone a mandate requiring all personal computers sold in the country to be accompanied by a controversial content-filtering application. If that software is in my desktop, I would be feeling uneasy knowing that everything I do, surf, type, whatever may not be possible in some cases because of that filtering. It is always good to know what is going on with your country and that filtering software will surely minimize content regarding politics. While its main purpose they say is to filter pornography, there will be other purposes not divulged to the public.
How about that? A Javascript reference application for the iTouch. Even expert Javascript programmers need references to methods, properties and syntax from time to time. I for one, use Google quite a lot to search for things I need regarding Javascript. If you do not have any internet access though, you got a problem. But if you have Javascript Cheat Sheet in your iTouch, you can easily look up what you need. Use it as a quick reference or if you are still new to JavaScript, use it to better understand what JavaScript it is about and what it can do.