|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Re: add an option on a web page to be able to turn music on or offruntime error of: Line 38 Unterminated String Constant Here is my actual code and I put (line 38) out to the right in parentheses. Do you see the mistake I've made? I don't. Your help is so appreciated!! <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <meta http-equiv="Content-Language" content="en-us" /> <title>Database Interface</title> <bgsound src="Music/Alone.wma" loop="-1"> </head> <body bgcolor="#ffffff"> <p><b><font size="+3" color="#000080">Database Interface</font></b></p> <p><a href="Sample_interface/Customers/results_page.asp" target="_top">Results Page</a><br /> A page that extracts its content from your database.</p> <p> <a href="Sample_interface/Customers/editor/submission_form.asp" target="_top">Submission Form</a><br /> A form that will insert its results into your database.</p> <p> <a href="Sample_interface/Customers/editor/database_editor.asp" target="_top">Database Editor</a><br /> A set of web pages that allow you to view, add, delete and update records in your database using a web browser.</p> </body> </html> <span id="sound"></span> <input type="button" value="Play/Stop Music" onclick="playSound('Alone.wma')"> <head><script type="text/javascript"> function playSound(fname) { var x = document.getElementById("sound") x.innerHTML = (!x.innerHTML ) ? '<embed src="' + fname + '" loop=false autostart=true hidden>' : '' (line 38) } </script> </head> -- Show quoteHide quotebgh "Trevor Lawrence" wrote: > "islandjohnny" <islandjoh***@discussions.microsoft.com> wrote in message > news:0FDC774E-3329-4ED4-B83D-373EC352A25C@microsoft.com... > >I saw a web site that with a click of the mouse on a graphic, it either > > turned on background music, or turned it off. I was wondering if Frontpage > > 2003 offered that feature and if do, how? > > FrontPage itself does not, but here is some simple code to do it > > Insert this code, using Code or HTML view, where you want the button: > <span id="sound"></span> > <input type="button" value="Play/Stop Music" > onclick="playSound('audio/minuet.mid')"/> > > Insert this JavaScript, using Code or HTML view, between <head> and > </head>: > <script type="text/javascript"> > function playSound(fname) > { > var x = document.getElementById("sound") > x.innerHTML = (!x.innerHTML ) ? '<embed src="' + fname + '" loop=false > autostart=true hidden>' : '' > } > </script> > > The function will play or stop the music on alternate clicks. > > Notes: > 1. Change the name of the file in "playSound('audio/minuet.mid')" to your > file > 2. Some of the quotes are single and some are double. Just cut and paste the > code above to get it right. > ---- > Trevor Lawrence > Canberra > Microsoft MVP - FrontPage > MVP Web Site http://trevorl.mvps.org > > > Well, the code after </html> belongs partly in the <head> section and partly
in the <body> section Re error in line 38. This line is split when posted, but I think you had fname + '" loop=false when you should have had fname + "' loop=false This is very difficult to pick up. The first line reads, between + and loop: single quote then double quote which is incorrect The corrected line reads: double quote then single quote. Try this (by cutting and pasting the code) <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <meta http-equiv="Content-Language" content="en-us" /> <title>Database Interface</title> <script type="text/javascript"> function playSound(fname) { var x = document.getElementById("sound") x.innerHTML = (!x.innerHTML ) ? '<embed src="' + fname + '"' /* "' is double then single^ ^ '"' is single then double then single */ + ' loop=false autostart=true hidden>' : '' /* ^ '' is two singles */} </script> </head> <body bgcolor="#ffffff"> <span id="sound"></span> <input type="button" value="Play/Stop Music" onclick="playSound('Alone.wma')"> <!-- Rest of html code --> </body> </html> This worked for me, using a file named 'minuet.mid'. Yours is a .wma file, but if the player recognises it, it should play OK Show quoteHide quote "bgh" <brid***@haakwine.com> wrote in message news:8836191F-F288-475F-889C-E939995A4866@microsoft.com... > Hi, Thanks so much for this help. When I use your code, it gives me a > runtime error of: Line 38 Unterminated String Constant > > Here is my actual code and I put (line 38) out to the right in > parentheses. > Do you see the mistake I've made? I don't. Your help is so appreciated!! >
Other interesting topics
|
|||||||||||||||||||||||