Hi,
Need some help with javascript, i wont to stop my mp3 flash player from reloading songs when changing pages. It can be done with javascript by updating div.
Enyone knows how must look this javascript?
How to update div's with javascript?
Started by razmarke, Mar 30 2007 12:08 PM
6 replies to this topic
#1
Posted 30 March 2007 - 12:08 PM
#3
Posted 30 March 2007 - 01:15 PM
Braunson, if you're not going to at least try and offer something useful, don't post. He knows javascript can do what he wants to do, he just doesn't know how.
Personally, i would use frames for this, but if you want to know how to update div's, check out quirksmode.org (http://www.google.com/search?hl=en&rls...smode+innerhtml)
Personally, i would use frames for this, but if you want to know how to update div's, check out quirksmode.org (http://www.google.com/search?hl=en&rls...smode+innerhtml)
#4
Posted 30 March 2007 - 04:47 PM
Well, from what I read I think you mean using AJAX which is true...it would give you the act of frames but much harder, however, looks cooler (to geeks like us hehe) if you really are against frames then yes, AJAX would solve that problem but as rc69 said frames solve the problem.
#5
Posted 30 March 2007 - 09:36 PM
I know that frames can fix my problem, but i dont wont use frames in my site
Plase if enyone know how must look AJAX post it...
Thanks for help
Plase if enyone know how must look AJAX post it...
Thanks for help
#6
Posted 30 March 2007 - 09:58 PM
Sorry, I was curious as to mabe where he read it. I didnt know that. Sorry >_> Sheesh.
#7
Posted 31 March 2007 - 01:46 AM
Ok well I don't know what type of navigation you want.. now you would need to edit this in full, but it should work.
http://javascript.in...navigation.html
I will go ahead and break it down now:
Place in between <head></head> tags on your document
Place in the body where you want it to appear
site... then the id="my_site_content" just add to a div where the content lay.
finally, save this is ajax_navigation.js
Ok, so that should work for what you need... you might need to cut and edit it to your liking and look
http://javascript.in...navigation.html
I will go ahead and break it down now:
Place in between <head></head> tags on your document
<script type="text/javascript" src="ajax_navagation.js"></script>
set_loading_message("Please wait while the page is opening....");
Place in the body where you want it to appear
<table>
<tr>
<td valign=top width=150>
<H5>My Navagation links</H5>
<a href="java script:void(0)" onclick="open_url('page-1.html','my_site_content');">Go to page 1</a><br>
<a href="java script:void(0)" onclick="open_url('page-2.html','my_site_content');">Go to page 2</a><br>
<a href="java script:void(0)" onclick="open_url('page-3.html','my_site_content');">Go to page 3</a><br>
<a href="java script:void(0)" onclick="open_url('page-4.html','my_site_content');">Go to page 4</a><br>
<a href="java script:void(0)" onclick="open_url('xxxx.html','my_site_content');">Broken Link</a><br>
</td>
<td valign=top>
<div id="my_site_content">
</div>
</td>
</tr>
</table>
Really only thing you need are the links in here, change them respectively and you can also just put them onto the links where you have for yoursite... then the id="my_site_content" just add to a div where the content lay.
finally, save this is ajax_navigation.js
var please_wait = null;
function open_url(url, target) {
if ( ! document.getElementById) {
return false;
}
if (please_wait != null) {
document.getElementById(target).innerHTML = please_wait;
}
if (window.ActiveXObject) {
link = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
link = new XMLHttpRequest();
}
if (link == undefined) {
return false;
}
link.onreadystatechange = function() { response(url, target); }
link.open("GET", url, true);
link.send(null);
}
function response(url, target) {
if (link.readyState == 4) {
document.getElementById(target).innerHTML = (link.status == 200) ? link.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the fallowing errorcode: " + link.status;
}
}
function set_loading_message(msg) {
please_wait = msg;
}
Ok, so that should work for what you need... you might need to cut and edit it to your liking and look
Edited by liveman, 31 March 2007 - 01:48 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
