Jump to content

Combing two AJAX plugins causing conflict


concusion

Recommended Posts

Hi, all, first I want to say thanks for your time to help me out.  I'm not an AJAX coder, I'm more of a find a script and tweak it to fit my needs.

 

What I'm currently trying to do was one of two things, as I run an internet television channel,  on each show page I wanted the episode archive to be paginated, as the archives get pretty long, and I'm not running a CMS so I found this AJAX Pagination Script (http://www.dynamicdrive.com/dynamicindex17/ajaxpaginate/index.htm) which I was able to institute.

 

Now these archive episode lists I wanted when they were clicked on to either load the video in an IBOX (javascript lightbox http://www.ibegin.com/labs/ibox/) or in a div on a page dynamically using this Dynamic Content Script  http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm  Whatever I can get to work Ill take :)

 

The pagination script if removed allows the other two options to work, however I cannot seem to figure out why these two scripts are conflicting. 

 

Here is part of the scripts in my the head of the document, I know its a wild mess

 

<style type="text/css">
<!--
.Headline {
color: #FFC;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 16px;
}
.Headline {
color: #FFF;
text-align: center;
}
<!--
A:link { text-decoration: none; color: #0066cc; font-size: 12px }
A:visited { text-decoration: none; color: #0066cc; font-size: 12px }
-->
<!--
A:hover { text-decoration: underline; color:#0066cc; font-size: 12px } 

-->

</style>
<link rel="stylesheet" type="text/css" href="ajaxpagination.css" />

<script src="ajaxpagination.js" type="text/javascript">
<script type="text/javascript">

/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

</script>
</head>

 

Then in the document I have this which is to load content in the DIV box when the page loads so its not blank.

 

<div id="contentarea"></div>
    <script type="text/javascript">
ajaxpage('streamscenedefault.htm', 'contentarea') //load "streamscenedefault.htm" into "contentarea" DIV
</script>

 

This works, if I yank this code for the pagination out of the header above

<link rel="stylesheet" type="text/css" href="ajaxpagination.css" />

<script src="ajaxpagination.js" type="text/javascript">

 

And this is the pagination script in action

<div id="bookcontent"> </div>

<div id="paginate-bottom"> </div>
<script type="text/javascript">

var streamepisodes={
pages: ["stream1.htm", "stream2.htm"],
selectedpage: 0 //set page shown by default (0=1st page)
}

var mybookinstance=new ajaxpageclass.createBook(streamepisodes, "bookcontent", ["paginate-bottom"])

</script>

 

If anyone can help me figure this out I would GREATLY appreciate it.

 

Thank you.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.