TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   Not good with jave help please? (http://www.talkphp.com/javascript-ajax-e4x/4597-not-good-jave-help-please.html)

KingOfTheSouth 06-23-2009 08:54 PM

Not good with jave help please?
 
I have no idea what I am looking at when it comes to JaveScript. What I want to do is add some tables and or whatever I need to make my news show up this code. I did not wirte this page.

PHP Code:

<?php
include("game_html.php");
secureheader();
siteheader();?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<table width="427" border="0" align="center">
  <tr>
    <td width="421" height="344">
    
    <SCRIPT language=JavaScript>
var imagenames=new Array('tru/gfx/-.gif', 'tru/gfx/mb.gif', 'tru/gfx/b0.gif', 'tru/gfx/b1.gif', 'tru/gfx/b2.gif', 'tru/gfx/b3.gif', 'tru/gfx/b4.gif', 'tru/gfx/b5.gif', 'tru/gfx/b6.gif', 'tru/gfx/bg.gif', 'tru/gfx/brl.gif', 'tru/gfx/brr.gif', 'tru/gfx/c0.gif', 'tru/gfx/c1.gif', 'tru/gfx/c2.gif', 'tru/gfx/c3.gif', 'tru/gfx/c4.gif', 'tru/gfx/c5.gif', 'tru/gfx/don.jpg', 'tru/gfx/donsh.jpg', 'tru/gfx/goldtable.jpg', 'tru/gfx/kdr.gif', 'tru/gfx/l.gif', 'tru/gfx/mb.gif', 'tru/gfx/od.gif', 'tru/gfx/pixel.gif', 'tru/gfx/r.gif', 'tru/gfx/rd.gif', 'tru/gfx/t.gif', 'tru/gfx/tb.gif', 'tru/gfx/tl.gif', 'tru/gfx/tr.gif');



var yposition=250;                                // POSITION OF LOAD BAR FROM TOP OF WINDOW, IN PIXELS
var barheight=28;                                // HEIGHT OF PROGRESS BAR IN PIXELS (MIN 25)
var barwidth=350;                                // WIDTH OF THE BAR IN PIXELS  
var bordercolor='';                        // COLOR OF THE BORDER
var newlocation='play.php';

// THE NEW LOCATION REPORTED TO THIS FILE'S LOCATION

//DO NOT EDIT BEYOND THIS POINT UNLESS YOU REALLY KNOW JAVASCRIPT
var NS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var IE4 = (document.all)? true : false;
var NS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var imagesdone=false;
var blocksize=barwidth/(imagenames.length);
barheight=Math.max(barheight,25);
var loaded=0, perouter, perdone, images=new Array();
var txt=(NS4)?'<layer name="perouter" bgcolor="'+bordercolor+'" visibility="hide">' : '<div id="perouter" style="position:absolute; visibility:hidden; background-color:'+bordercolor+'">';
txt+='<table cellpadding="0" cellspacing="1" border="0"><tr><td width="'+barwidth+'" height="'+barheight+'" valign="center">';
if(NS4)txt+='<ilayer width="100%" height="100%"><layer width="100%" height="100%"  background="http://www.themafiaboss.com/images/main/pl_back.gif" top="0" left="0">';
txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" width="'+barwidth+'" height="'+barheight+'"  background="http://www.themafiaboss.com/images/main/pl_back.gif"><center><span style="font-family: sans-serif; color: gray; font-weight: bold; font-size: 10px;">Loading ClubbinKings - Please wait...</span></center></td></tr></table>';
if(NS4) txt+='</layer>';
txt+=(NS4)? '<layer name="perdone" width="100%" height="'+barheight+'" background="/images/nav.jpg" top="0" left="0">' : '<div id="perdone" style="position:absolute; top:1px; left:1px; width:'+barwidth+'px; height:'+barheight+'px; background="/images/nav.jpg"; z-index:100">';
txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" width="'+barwidth+'" height="'+barheight+'" background="/images/nav.jpg""><center><span style="font-family: sans-serif; color: white; font-weight: bold; font-size: 10px;">Loading ClubbinKings - Please wait...</span></center></td></tr></table>';
txt+=(NS4)? '</layer></ilayer>' : '</div>';
txt+='</td></tr></table>';
txt+=(NS4)?'</layer>' : '</div>';

document.write(txt);
function loadimages(){
if(NS4){
perouter=document.perouter;
perdone=document.perouter.document.layers[0].document.perdone;
}
if(NS6){
perouter=document.getElementById('perouter');
perdone=document.getElementById('perdone');
}
if(IE4){
perouter=document.all.perouter;
perdone=document.all.perdone;
}
cliplayer(perdone,0,0,barheight,0);
window.onresize=setouterpos;
setouterpos();
for(n=0;n<imagenames.length;n++){
images[n]=new Image();
images[n].src=imagenames[n];
setTimeout('checkload('+n+')' ,n*100);
}}
function setouterpos(){
var ww=(IE4)? document.body.clientWidth : window.innerWidth;
var x=(ww-barwidth)/2;
if(NS4){
perouter.moveTo(x,yposition);
perouter.visibility="show";
}
if(IE4||NS6){
perouter.style.left=x+'px';
perouter.style.top=yposition+'px';
perouter.style.visibility="visible";
}}
function dispbars(){
loaded++;
cliplayer(perdone, 0, blocksize*loaded, barheight, 0);
if(loaded>=imagenames.length)setTimeout('hideperouter()', 800);
}
function checkload(index){
if (images[index].complete)
  {
  dispbars();
  }
else
  {
  setTimeout('checkload('+index+')', 100);
  }
}
function hideperouter(){
(NS4)? perouter.visibility="hide" : perouter.style.visibility="hidden";
imagesdone=true;
window.location='play.php';
}
function cliplayer(layer, ct, cr, cb, cl){
if(NS4){
layer.clip.left=cl;
layer.clip.top=ct;
layer.clip.right=cr;
layer.clip.bottom=cb;
}
if(IE4||NS6)layer.style.clip='rect('+ct+' '+cr+' '+cb+' '+cl+')';
}
window.onload=loadimages;
</SCRIPT>

                  <SPAN 
                  style="WIDTH: 75%"><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><FONT 
                  size=+2><B>WARNING</B></FONT> <BR><BR><BR><FONT 
                  size=+1><B>Multiple Accounts</B></FONT> <BR>Having more then 1 
                  account is <B>strictly forbidden</B>. If we come to believe 
                  you are using more than one account, we will remove your 
                  account. The chances of getting unbanned for multiple accounts 
                  is very slim. <BR><BR><FONT size=+1><B>Shared 
                  Computers</B></FONT> <BR>As this is a browser based game and 
                  therefore difficult to prevent cheating we are very strict 
                  about sharing the same computer. Don't even log into your 
                  friends computer as it will show as multi and 1 or both 
                  accounts will be banned from the game.We take pride in having 
                  a cheat free game.This rule applies to 2 people using SAME 
                  COMPUTER and NOT ip or 2 computers in same home. 
                  <BR><BR></SPAN><!-- CONTENT ENDS HERE --></td>
  </tr>
</table>
</body>
</html>
<?
sitefooter
();
?>


Wildhoney 06-23-2009 09:49 PM

Oh, such a mess! That is bad JavaScript code, and incredibly difficult to debug because of all the HTML mess. I much prefer the OOP way of creating HTML elements in JavaScript, such as like document.createElement.

Perhaps somebody else can have a stab at debugging this, but I am just here with a caveat that this not the approach to take, for others thinking: "That's a mess! JavaScript sucks!"

Sorry, but I know I can be so blunt because you didn't code it :-) !

adamdecaf 06-23-2009 11:40 PM

Well, jsLint got a whole 0% of it processed.

My advice, learn from code that this author didn't write.

P.S. Its JavaScript not JaveScript.

sketchMedia 06-24-2009 08:50 AM

Quote:


//DO NOT EDIT BEYOND THIS POINT UNLESS YOU REALLY KNOW JAVASCRIPT

That was funny for me to read, seen as though the guy who wrote it has abused javascript like so many people, no wonder JS gets such a bad press!

I don't understand the question, do you want it debugging or want advice on something else, as I'm afraid the statement
Quote:

What I want to do is add some tables and or whatever I need to make my news show up this code
has me stumped currently.

Wildhoney 06-24-2009 10:39 AM

Quote:

Originally Posted by sketchMedia (Post 25937)
//DO NOT EDIT BEYOND THIS POINT UNLESS YOU REALLY KNOW JAVASCRIPT

I love it! Hehe :-)


All times are GMT. The time now is 09:27 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0