Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the 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 June 25th, 2006, 12:25 PM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default 'song' is undefined

Heres the code if anyone could read through and check it out for me?!

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

theForm is the form where this code is supposed to get its variables from.
artist_find and song_find are textboxes within the form where the variables will entered in.

var song = document.theForm.song_find.value; //this is supposed to make the value of the textbox a variable
var artist = document.theForm.artist_find.value; //same as above


Below is the code which writes the variables out and creates a new html page:
function call_song(artist, song){
    document.write('<html>'); //this is meant to write out a new html page
    document.write('<body>'); //and it does do that, i've tried an tested it
    document.write('<img src="searchresults.jpg">')
    document.write('<OBJECT ID="mediaPlayer" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" STANDBY="Loading Microsoft Windows Media Player components..." TYPE="application/x-oleobject">');
    document.write('<PARAM NAME="fileName" VALUE="N:\Music Manager\Music\' + artist + song + ''">');
    document.write('<PARAM NAME="animationatStart" VALUE="true">');
    document.write('<PARAM NAME="transparentatStart" VALUE="true">');
    document.write('<PARAM NAME="autoStart" VALUE="false">');
    document.write('<PARAM NAME="showControls" VALUE="true">');
    document.write('</OBJECT>');
    document.write('</body>');
    document.write('</html>');
}
</script>
__________________
Apocolypse2005, I'm a programmer - of sorts.
 
Old June 25th, 2006, 12:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

is the variable declared in the same block of code as the function that uses it, otherwise it could be out of scope ?
 
Old June 26th, 2006, 06:14 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

no i've declared it as a global variable!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
play multiple song using embeded media player kumiko Javascript 0 September 10th, 2008 11:10 AM
Undefined index junemo Pro PHP 8 October 31st, 2007 05:45 PM
undefined Adam H-W Javascript 5 September 26th, 2007 01:31 AM
How to know a variable is undefined? Edward King Javascript How-To 3 June 14th, 2005 10:14 AM
Page song want to play continually surendran HTML Code Clinic 1 February 18th, 2005 10:03 AM





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