Javascript pastes the html into itself? -
ok, sounds kind of weird, here i'm dealing with. on website, when try load it, there nothing in body tags. when @ chrome developer console, stops after fetching stylesheet, inside ajax.js file of html goes inside body. contents of ajax.js file not contain body of html, why showing there? here shows up: :( cant post image html:
<?php $_session['framestart'] = $_post['framestart']; $_session['framestop'] = $_post['framestop']; $_session['format'] = $_post['format']; $_session['currframe'] = $_post['framestart'] - 1; ?> <!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"> <head> <title>openrender - free online rendering</title> <link rel="stylesheet" type="text/css" href="main.css" /> <script type="text/javascript" src="ajaxz.js" /> <?php flush(); ?> </head> <body> <div id="content" > <img src="images/logo.png" alt="openrender logo" id="logo" class="centermargin" /> <h1 id="topinfo"> site version: 1.0<span id="space" />backend: <?php if (file_get_contents("/blend/online") == 0) { echo '<span id="green">online</span> <img src="images/greenlight.png" alt="green light" id="light" />'; } else { echo '<span id="red">offline</span> <img src="images/redlight.png" alt="red light" id="light" />'; } ?> </h1> <div id="innerbox"> <h1 id="status"> javascript turned off </h1> <div id="controlpanel"> <a href=""> <img src="images/play.png" alt="play" id="play" /> </a> <a href=""> <img src="images/stop.png" alt="stop" id="stop" /> </a> <a href=""> <img src="images/info.png" alt="info" id="info" /> </a> </div> <img src="images/scene.png" alt="thumbnail of rendered picture" id="thumbnail" class="centermargin" /> <h2 id="framenumber"> frame: 0/0 </h2> <img src="images/loading.gif" alt="loading" id="loading" class="centermargin" /> <a href="images/song.mp4" target="_blank"> <img src="images/song.png" alt="sound" id="sound" /> </a> </div> <div id="bottombar"> <a href="http://www.facebook.com/pages/openrender/107428762671996" target="_blank"> <img src="images/facebook.png" alt="facebook" id="facebook" /> </a> <a href="http://twitter.com/#!/openrender" target="_blank"> <img src="images/twitter.png" alt="twitter" id="twitter" /> </a> <p id="emailtext"> contact at:<br /> openrender@gmail.com </p> <p id="credittext"> created by: braun , marc<br /> donations: facetime inc. </p> </div> </div> </body> </html>
the javascript file:
window.onload = function(){init();} function init() { var ajax = ajaxinit(); ajax.onreadystatechange = update(ajax); ajaxcontact(ajax); setinterval("ajaxcontact('"+ajax+"')",1000); } function ajaxinit() { if (window.xmlhttprequest) { ajax = new xmlhttprequest(); } if (window.activexobject) { ajax = new activexobject("microsoft.xmlhttp"); } if (ajax) { document.getelementbyid("status").innerhtml = "ajax initialized"; return ajax; } else { docuement.getelementbyid("status").innerhtml = "error: ajax not available"; return false; } } function ajaxcontact(ajax) { try { ajax.open("get","ajax.php?" + "&ran=" + math.random(),true); ajax.send(); } catch (err) { document.getelementbyid("status").innerhtml = "error contacting server"; document.getelementbyid("loading").src = "images/redx.png"; } } function update(ajax) { if (ajax.readystate==4 && ajax.status==200){ var dataobj = jsontranslate(); document.getelementbyid("status").innerhtml = dataobj.status; document.getelementbyid("frame").innerhtml = "frame:" + dataobj.firstframe + "/" + dataobj.lastframe; document.getelementbyid("thumbnail").src = dataobj.imgsrc; } if (ajax.status==404) { document.getelementbyid("status").innerhtml = "ajax updater not found"; document.getelementbyid("loading").src = "images/redx.png"; } } function jsontranslate() { return eval('(' + ajax.responsetext + ')'); }
get rid of php stuff, show turns in browser. if nothing turning in browser, have php problem, not javascript problem.
you should using html, not xhtml.
you should not using:
<script type="text/javascript" src="ajaxz.js" />
a closing tag required, browsers may not shortag version (your server may changing <script...></script>, don't know that).
Comments
Post a Comment