Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript
|
BOOK: Beginning JavaScript
This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 25th, 2005, 03:18 PM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default I get object expected but can't find out why

the page is saved under
www.geocities.com/musicyid/lukt.html
ones it's finished with one song it sould go to a second song from the playlist by using a timeout, but it doesn't go
can someone help me!!
<html>
<head>
<script language="javascript">


function sivamtime() {
       var hour1 = 10;
       var min1 = 10;
       var sec1 = 10;
       var straddr = "";
       var sec = (straddr.charAt(straddr.length - 6) +
       straddr.charAt(straddr.length - 5));
       var min = (straddr.charAt(straddr.length - 9) +
       straddr.charAt(straddr.length - 8));
       var hour = (straddr.charAt(straddr.length - 12) +
       straddr.charAt(straddr.length - 11));

       document.write(""+hour+":"+min+":"+sec+"");
       document.write("<br>");
       document.write(""+hour1+":"+min1+":"+sec1+"");
       document.write("");
       document.write("<br>");

       if (hour>hour1) {
               newhour=hour-hour1;
       } else if (hour<hour1) {
               temphour=24-hour1;
               temphour2=temphour-hour
               if (temphour2<0) {
                       newhour=24+temphour2-4;
               } else {
                       newhour=24+temphour2-4
               }
       } else {
               newhour=0;
       }
       //end of hours

       //start of minutes
       if (min>min1) {
               newmin=min-min1;
       } else if (min<min1) {
               tempmin1=60-min;
               tempmin2=tempmin1+min1;
               newmin=tempmin2-20;
       } else {
               newmin=0
       }
       //end of minutes

       //start of seconds
       if (sec>sec1) {
               newsec=sec-sec1;
       } else if (sec<sec1) {
               tempsec1=60-sec;
               tempsec2=tempsec1+sec1;
               newsec=tempsec2-20;
       } else {
               newsec=0
       }

       document.write(newhour);
       document.write(":");
       document.write(newmin);
       document.write(":");
       document.write(newsec);
       document.write("<br>");
       document.write("");
       document.write("<br>");

       //convert total time to seconds

       var tst1=newhour*1200;
       var tst2=newmin*60;
       var tst3=tst1+tst2;
       var totalsec=tst3+newsec;
       document.write(tst1);
       document.write("<br>");
       document.write(tst2);
       document.write("<br>");
       document.write(totalsec);
       document.write("");

       //playlist with musicname and time

       function music(name,length,title) {
               this.name=name; this.length=length
       }

       var line = new Array()
       line[0] = new music('muziek',1123)
       line[1] = new music('muziek2',1456)
       line[2] = new music('muziek3',1789)
       line[3] = new music('muziek',1011)
       line[4] = new music('muziek2',1213)
       line[5] = new music('muziek3',1715)
       line[6] = new music('muziek',1617)
       line[7] = new music('muziek2',1319)
       line = new music('muziek3',3321)
       line[9] = new music('muziek',520)
       line[10] = new music('muziek2',1150)
       line[11] = new music('muziek3',4150)
       line[12] = new music('muziek',1150)
       line[13] = new music('muziek2',1150)
       line[14] = new music('muziek3',1150)
       line[15] = new music('muziek',1150)
       line[16] = new music('muziek2',1456)
       line[17] = new music('muziek3',1456)
       line[18] = new music('muziek',1456)
       line[19] = new music('muziek2',1456)
       line[20] = new music('muziek3',1456)
       line[21] = new music('muziek',1456)
       line[22] = new music('muziek2',1456)
       line[23] = new music('muziek3',1456)
       line[24] = new music('muziek',1456)
       line[25] = new music('muziek2',1456)
       line[26] = new music('muziek3',1456)
       line[27] = new music('muziek',1456)
       line[28] = new music('muziek2',1456)
       var playlist= 0;
       var time=totalsec;
       var songnumber=0;
       document.write(playlist+"<BR>");
       document.write(songnumber+"<BR>");
       document.write(time+"<BR>");

       while (time > playlist) {
               playlist=playlist+line[songnumber].length;
               document.write(playlist+"<BR>");


       }
       var musicsrc="http://www.musicyid.com/music/"+line[songnumber].name+".mp3";
       document.write('<bgsound src='+'"'+musicsrc+'">')

timeout()


}

function timeout(){
setTimeout('sivamtime()',10000);}



</script>
</head>
<body onload="sivamtime()">

<script language="javascript">

</script>



</body>
</html>
 
Old January 25th, 2005, 03:22 PM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default


the timeout is not 10000 as i wrote befor but

function timeout(){
setTimeout('sivamtime()',line[songnumber].length);}
so that the time of the timeout the same is as the length of the song






Similar Threads
Thread Thread Starter Forum Replies Last Post
Object expected darkhalf Javascript 1 September 28th, 2006 05:32 PM
Object Expected!! Apocolypse2005 Javascript 0 July 3rd, 2006 12:23 PM
object expected crmpicco Javascript 3 April 19th, 2006 09:07 AM
object expected shoakat Classic ASP Databases 3 September 20th, 2004 08:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.