iaa
07-25-2014, 06:36 PM
Dear Sir Please help me. I have spent enough time almost two weeks to get this sorted but no reply.
I am trying to Make a HTML5 Video play when a link is clicked though a external Ajax page. its said allover that ajax has a different way of calling. I used the dynamic drive site code thus:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ajax Rotating Includes Script</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<script type="text/javascript">
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
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)
}
page_request.open('GET', url, 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(){
// alert("LOAD OBJECT");
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>
<style type="text/css">
#contentright{
float:left;
width:150px;
height: 400px;
border: 3px solid black;
padding: 5px;
padding-left: 8px;
}
#contentright a{
padding: 3px 1px;
display: block;
width: 100%;
text-decoration: none;
font-weight: bold;
border-bottom: 1px solid gray;
}
#contentright a:hover{
background-color: #FFFF80;
}
#movm_cal_right_box{
background-color:#099;
width:550px;
float:left;
left:145px;
min-height: 400px;
border: 3px solid black;
margin-left: 10px;
padding: 5px;
padding-bottom: 8px;
}
</style>
</head>
<body>
<div id="contentright">
<a href="javascript:ajaxpage('external1.htm', 'movm_cal_right_box');">Porsche Page</a>
<a href="javascript:ajaxpage('external2.htm', 'movm_cal_right_box');">Ferrari Page</a>
<a href="javascript:ajaxpage('external3.htm', 'movm_cal_right_box');">Aston Martin Page</a>
</div>
<div id="movm_cal_right_box">
Some text here
</div>
</body>
</html>
<a href="javascript:ajaxpage('external1.htm', 'movm_cal_right_box');">Porsche Page</a> When I click this, in the external1.htm I Am doing a simple html5 player call.
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<h3 id="cartitle" style="border-bottom: 1px solid #C0C0C0; margin-bottom: -5px">Porsche Carrera GT</h3>
<div id="video-container">
<!-- Video -->
<video id="video" width="640" height="365">
<source src="echo-hereweare.mp4" type="video/mp4">
<p>
Your browser doesn't support HTML5 video.
<a href="videos/echo-hereweare.mp4">Download</a> the video instead.
</p>
</video>
<!-- Video Controls -->
<div id="video-controls">
<button type="button" id="play-pause" class="play">Play</button>
<input type="range" id="seek-bar" value="0">
<button type="button" id="mute">Mute</button>
<input type="range" id="volume-bar" min="0" max="1" step="0.1" value="1">
<button type="button" id="full-screen">Full-Screen</button>
</div>
</div>
But when the ajax loads this external1.htm as usual the html5 player dosnet work.
How can I get this work through ajax to play a HTML5 mp4 Video.
Thanking you
I am trying to Make a HTML5 Video play when a link is clicked though a external Ajax page. its said allover that ajax has a different way of calling. I used the dynamic drive site code thus:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ajax Rotating Includes Script</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<script type="text/javascript">
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
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)
}
page_request.open('GET', url, 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(){
// alert("LOAD OBJECT");
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>
<style type="text/css">
#contentright{
float:left;
width:150px;
height: 400px;
border: 3px solid black;
padding: 5px;
padding-left: 8px;
}
#contentright a{
padding: 3px 1px;
display: block;
width: 100%;
text-decoration: none;
font-weight: bold;
border-bottom: 1px solid gray;
}
#contentright a:hover{
background-color: #FFFF80;
}
#movm_cal_right_box{
background-color:#099;
width:550px;
float:left;
left:145px;
min-height: 400px;
border: 3px solid black;
margin-left: 10px;
padding: 5px;
padding-bottom: 8px;
}
</style>
</head>
<body>
<div id="contentright">
<a href="javascript:ajaxpage('external1.htm', 'movm_cal_right_box');">Porsche Page</a>
<a href="javascript:ajaxpage('external2.htm', 'movm_cal_right_box');">Ferrari Page</a>
<a href="javascript:ajaxpage('external3.htm', 'movm_cal_right_box');">Aston Martin Page</a>
</div>
<div id="movm_cal_right_box">
Some text here
</div>
</body>
</html>
<a href="javascript:ajaxpage('external1.htm', 'movm_cal_right_box');">Porsche Page</a> When I click this, in the external1.htm I Am doing a simple html5 player call.
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<h3 id="cartitle" style="border-bottom: 1px solid #C0C0C0; margin-bottom: -5px">Porsche Carrera GT</h3>
<div id="video-container">
<!-- Video -->
<video id="video" width="640" height="365">
<source src="echo-hereweare.mp4" type="video/mp4">
<p>
Your browser doesn't support HTML5 video.
<a href="videos/echo-hereweare.mp4">Download</a> the video instead.
</p>
</video>
<!-- Video Controls -->
<div id="video-controls">
<button type="button" id="play-pause" class="play">Play</button>
<input type="range" id="seek-bar" value="0">
<button type="button" id="mute">Mute</button>
<input type="range" id="volume-bar" min="0" max="1" step="0.1" value="1">
<button type="button" id="full-screen">Full-Screen</button>
</div>
</div>
But when the ajax loads this external1.htm as usual the html5 player dosnet work.
How can I get this work through ajax to play a HTML5 mp4 Video.
Thanking you