PDA

View Full Version : way over my head



riptide
02-01-2007, 02:26 PM
I'm trying to make a script that makes a popup div with a navi and plays a movie that the user picks from the main page list. I'm not sure if this works right

<script language="javascript" type="text/javascript" >

/*function to make the new movie <div> and find what HTML <li> was clicked*/

function misterio(){
var Mpdiss=document.get.ElementById("misterioProgram")
var Watching=watchShows.childNode.childNode.a
function MakeDiv{
if (Mpdiss.Display="none")
{Mpdiss.Display="block"}

if(!e)
var e=window.event; whichlink=(e.target) ? e.target.id: e.srcElement.id;
switch (whichlink) {case "watchshows.tt1.ChildNode.a" : misterioProgram.ChooseSeason.Mtt1.display="block";misterioProgram.ChooseSeason.Mtt1.zIndex="100";
break; }}}

/*function to display a div with the links and movie*/

function plugoff(){var tork=document.getElementById("plugs");
tork.style.display="none"}
setTimeout("plugoff():"18000);}


/*function to get the object and tags code for the users plugs in and show a pop up div so they can go to the sites if they need more*/

function reader(){
try {document.write (clsid:6BF52A52-394A-11d3B153-00C04F79FAA)};
catch(e){ try { document.write (clsid:02BF2505-8C17-4B23-BC80-D3488ABDDC6B)};
catch(e){try{document.write (clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA)};
catch {confirm("you don't have anything to play AVIs. To get something click okay")
if(true){document.write("<div id='plugs'> for quick time http://www.apple.com/qtactivex/qtplugin.cab For windosw media http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0 or http://www.microsoft.com/windows/windowsmedia/player/10/default.aspx for realplayer http://www.real.com/ </div>")};

/*function to find the right pluginspage for the embed tag*/

function emplug{ if (clsid=02BF25D5-8C17-4B23-BC80-D3488ABDDC6B ){ 'http://www.apple.com/quicktime/download/'}if else(clsid=6BF52A52-394A-11d3B153-00C04F79FAA){'http://microsoft.com/windows/mediaplayer/ en/download/'} if else (clsid=CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA){'http://www.real.com/products/player/'}}

/*a function that adds the codebase*/

function quick() {if(clsid=6BF52A52-394A-11d3B153-00C04F79FAA) ('http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0')
if else (clsid=02BF25D5-8C17-4B23-BC80-D3488ABDDC6B) {document.write('http://www.apple.com/qtactivex/qtplugin.cab')}

/*function that writes all the object and embed tags*/
function playMTV()
if{ (! document.getElementByID)return;
var divs=document.getElementByTagName(li);
for (mist=0;mist<divs.length;mist++)
{ document.write('<object id=" '+' W '+ divs[mist].id + '"standby="this will take some time"<img src="misterioloder" '); document.write('CLASSID="'reader() + ' " width="640" height="504" '); document.write ('codebase=" ' quick() '> <param name="autoStart" value="false" /> <param name="EnableJavaScript" value="true"/> <param name="PlayCount" value="1"/><param name=showControls" value="1"/><param name="HREF" value=" 'divs[mist].id + '.avi "/>'); document.write( '<embed id=" '+divs[mist].id+'"');document.write('pluginspage="' emplug() '" src=" '+divs[mist].id+ .avi '" width="640" height="504" autostart="false" enablejavascript="true"></embed></object>'); MisterioProgram.toplogo.Vrip.onload=playMTV(R);}}


/*the function that plays the AVIs*/
function playMTV(R){if (!R) var R=window.event; thisvid=(R.target)?:R.scrElement;
var movson=document.getElementById("w"+movson.id); try{movson.DoPlay();}catch(R){try {movson.Play();catch(R){alert(" No video player try realplayer,WMP or quicktime");}}}
PlayMTV();}
watchShows.childNode.childNode.onclick=Misterio()
function macclo{ document.write("<div id='closing'><p onclick='closeit()'>close Misterio</p></div>")
/*a function that stops and closes the movie div*/
function closeit(){if(Mpdiss.display="block"; try{stop()}catch(R){try{doStop()}catch(R)alert("stop the movie before closing");}
</script>
[/COLOR]

Twey
02-01-2007, 06:43 PM
Of course not. It doesn't work at all, it's full of errors.

I doubt anyone's going to comb through that mess to debug it for you though. Maybe if you tidied it up a bit...

riptide
02-01-2007, 07:17 PM
the indents didn't stay when I pasted it.

I should have added the html so you can understand it more. I'll fix the it.
??? looks like I'll have to fix it with color.

mburt
02-01-2007, 08:58 PM
Yep, there is some serious problems with that script, not closing curly-braces, normal brackets, valid attributes, etc.

riptide
02-03-2007, 08:15 PM
There are a lot of embeded functions. normal brackets? where is there a problem with that. I thought all my attributes were valid. what's wrong?

mburt
02-03-2007, 08:25 PM
For example.
Line Two: var Mpdiss=document.get.ElementById("misterioProgram")

document.get.ElementById should be document.getElementById

That, for one is invalid.

Twey
02-03-2007, 08:41 PM
The indentation isn't a problem (although it can be preserved by using
tags) so much as the lack of linebreaks. Trying to decipher lines like:[code]var movson=document.getElementById("w"+movson.id); try{movson.DoPlay();}catch(R){try {movson.Play();catch(R){alert(" No video player try realplayer,WMP or quicktime");}}}... would slow down the task of any human debugger no end.

riptide
02-11-2007, 06:48 PM
ah okay. but as for what the script does, do you see any thing wrong with it. did I learn JS wrong or something.

Twey
02-11-2007, 07:45 PM
Yes!


if (Mpdiss.Display="none") The property is display, not Display; = is an assignment operator, not a comparison operator;
if (clsid=6BF52A52-394A-11d3B153-00C04F79FAA)clsid is undefined; the classid itself should be a string, meaning it should be in quotes;
if(true){this is useless... I am sure there are more.

As I said above, there are countless errors. However, your code, by vice of a serious lack of layout (pretty colours are all very nice, but they don't make it any more readable) is virtually indecipherable. I repeat: if you lay your code out nicely, either myself or someone else will most likely be more than happy to go through it and point out or even correct these errors, but as it is, we've better things to do with our time than make your code legible.

riptide
02-12-2007, 03:24 PM
I'll post the code again with it fixed and readable, I'm working out all the html and css that's needed.

okay I see the mistake but the if true thing was the one thing I wan't sure if it would work. I had a code made by some one else that used = as an comparison operator and it still worked so I didn't really think about it but with a code like this I guess I should be more careful.


function misterio(){
var Mpdiss=document.getElementById("misterioProgram")
var Watching=watchShows.childNode.childNode.a
function MakeDiv{
if (Mpdiss.display="none")
{Mpdiss.display="block"}

if(!e)
var e=window.event; whichlink=(e.target) ? e.target.id: e.srcElement.id;
switch (whichlink) {case "watchshows.tt1.ChildNode.a" : misterioProgram.ChooseSeason.Mtt1.display="block";misterioProgram.ChooseSeason.Mtt1.zIndex="100";
break; }}}

/*function to display a div with the links to plus ins*/
function plugoff(){var tork=document.getElementById("plugs");
tork.style.display="none"}
setTimeout("plugoff():"18000);}


/*function to make the html object and embed tags and get the right code for the users plug in*/

function reader(){
try {document.write ("clsid:6BF52A52-394A-11d3B153-00C04F79FAA")};
catch(e){ try { document.write ("clsid:02BF2505-8C17-4B23-BC80-D3488ABDDC6B")};
catch(e){try{document.write ("clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA")};
catch {confirm("you don't have anything to play AVIs. To get something click okay")
if(true){document.write("<div id='plugs'> for quick time http://www.apple.com/qtactivex/qtplugin.cab For windosw media http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0 or http://www.microsoft.com/windows/windowsmedia/player/10/default.aspx for realplayer http://www.real.com/ </div>")};

/*function to find the right pluginspage for the embed tag*/

function emplug{ if (clsid=="02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ){ 'http://www.apple.com/quicktime/download/'}if else(clsid=="6BF52A52-394A-11d3B153-00C04F79FAA"){'http://microsoft.com/windows/mediaplayer/ en/download/'} if else (clsid=="CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"){'http://www.real.com/products/player/'}}


/*a function that adds the codebase*/

function quick() {if(clsid=="6BF52A52-394A-11d3B153-00C04F79FAA") ('http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0')
if else (clsid=="02BF25D5-8C17-4B23-BC80-D3488ABDDC6B") {document.write('http://www.apple.com/qtactivex/qtplugin.cab')}

/*function that writes all the object and emb tags*/
function playMTV()
if{ (! document.getElementById)return;
divs=document.getElementByTagName(li);
for (mist=0;mist<divs.length;mist++)
{ document.write('<object id=" '+' W '+ divs[mist].id + '"standby="this will take some time"<img src="misterioloder" '); document.write('CLASSID="'reader() + ' " width="640" height="504" '); document.write ('codebase=" ' quick() '> <param name="autoStart" value="false" /> <param name="EnableJavaScript" value="true"/> <param name="PlayCount" value="1"/><param name=showControls" value="1"/><param name="EnableFullScreenControls" value="0">
<param name="ShowControls" value="-1">
<param name="ShowAudioControls" value="-1">
<param name="ShowStatusBar" value="1">
<param name="HREF" value=" 'divs[mist].id + '.avi "/>'); document.write( '<embed id=" '+divs[mist].id+'"');document.write('pluginspage="' emplug() '" src=" '+divs[mist].id+ .avi '" width="640" height="504" autostart="false" enablejavascript="true"></embed></object>'); MisterioProgram.toplogo.Vrip.onload=playMTV(R);}}

/*the function tath plays the AVIs*/
function playMTV(R){if (!R) var R=window.event; thisvid=(R.target)?:R.scrElement;
var movson+document.getElementById("w"+movson.id); try{movson.DoPlay();}catch(R){try {movson.Play();catch(R){alert(" No video player try realplayer,WMP or quicktime");}}}
PlayMTV();}
watchShows.childNode.childNode.onclick=Misterio()
function macclo{ document.write("<div id='closing'><p onclick='closeit()'>close Misterio</p></div>")

/*a function that stops and closes the div movie div*/
function closeit(){if(Mpdiss.display="block"; try{stop()}catch(R){try{doStop()}catch(R)alert("stop the movie before closing");}
</script>

riptide
02-15-2007, 08:34 PM
is there any thing else I need to explain?

mburt
02-15-2007, 08:39 PM
"=" assigns an operator, nothing else.
If you did:


var s = "value 1"
var p;
if (p=s) {
dosomething();
}
"p" now equals "value 1". You have succesfully assigned "p" a value :) To compare the two, use ==. I'm sure Twey already stated this, I was just trying to make it more clear.

riptide
02-17-2007, 10:45 PM
I understand. but now I'm going to look over that code I was given....

I meant do you see anything wrong I fixed the mistakes I saw.

riptide
03-02-2007, 09:03 PM
heay I'm reading something about not counting child nodes. and that I should count elements. does anyone have any idea what that is about.