Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post

    javascript in embed src=""

    Is it possible to use Javascript to write the <embed></embed> object? If so I need the bold part written in the embed src.
    Code:
    <script language="JavaScript" type="text/javascript">
    <!--
    
    function go(action) {
    	//var BaseUrl = "http://www.audio-bible.com/bible/";
    	var BaseUrl = "http://www.audio-bible.com/cgi-ab/hurl?f=/ab/audio/kjv/";
    	var theForm = document.forms["myForm"], query = "";
    	query +=  "" + theForm.Book.options[theForm.Book.selectedIndex].value;
    	query += "_" + theForm.Chapter.options[theForm.Chapter.selectedIndex].value;
    	query += ".ra";
    	theForm.url.value = BaseUrl + query;
    
    
    	if(action == "refresh") {
    		self.location.href = "listenspokes.asp?" + "book=" + (theForm.Book.selectedIndex + 1);
    
    	} else {
    		ifrVerse.location.href = "listenspokesresp.asp?" + "book=" + (theForm.Book.selectedIndex + 1) + "chapter=" + theForm.Chapter.selectedIndex<%'+ query%>;
    
    	}
    
    }
    
    //-->
    Code:
    <embed src="?" width="376" height="32"></embed>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I'm not to sure how well this will work.
    Code:
    <embed src="" width="376" height="32" id="theembed"></embed>
    Code:
    function go(action) {
    	//var BaseUrl = "http://www.audio-bible.com/bible/";
    	var BaseUrl = "http://www.audio-bible.com/cgi-ab/hurl?f=/ab/audio/kjv/";
    	var theForm = document.forms["myForm"], query = "";
    	query +=  "" + theForm.Book.options[theForm.Book.selectedIndex].value;
    	query += "_" + theForm.Chapter.options[theForm.Chapter.selectedIndex].value;
    	query += ".ra";
    	theForm.url.value = BaseUrl + query;
    
    
    	if(action == "refresh") {
    		self.location.href = "listenspokes.asp?" + "book=" + (theForm.Book.selectedIndex + 1);
    
    	} else {
    		ifrVerse.location.href = "listenspokesresp.asp?" + "book=" + (theForm.Book.selectedIndex + 1) + "chapter=" + theForm.Chapter.selectedIndex<%'+ query%>;
    
    	}
    document.getElementById('theembed').setAttribute('src',BaseUrl + query);
    }
    What will be going inside the embed anyways? Sound files from the books? What file type will the sound be? mp3, wma, wav?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by _Aerospace_Eng_
    I'm not to sure how well this will work.
    Code:
    <embed src="" width="376" height="32" id="theembed"></embed>
    Code:
    function go(action) {
    	//var BaseUrl = "http://www.audio-bible.com/bible/";
    	var BaseUrl = "http://www.audio-bible.com/cgi-ab/hurl?f=/ab/audio/kjv/";
    	var theForm = document.forms["myForm"], query = "";
    	query +=  "" + theForm.Book.options[theForm.Book.selectedIndex].value;
    	query += "_" + theForm.Chapter.options[theForm.Chapter.selectedIndex].value;
    	query += ".ra";
    	theForm.url.value = BaseUrl + query;
    
    
    	if(action == "refresh") {
    		self.location.href = "listenspokes.asp?" + "book=" + (theForm.Book.selectedIndex + 1);
    
    	} else {
    		ifrVerse.location.href = "listenspokesresp.asp?" + "book=" + (theForm.Book.selectedIndex + 1) + "chapter=" + theForm.Chapter.selectedIndex<%'+ query%>;
    
    	}
    document.getElementById('theembed').setAttribute('src',BaseUrl + query);
    }
    What will be going inside the embed anyways? Sound files from the books? What file type will the sound be? mp3, wma, wav?
    Well the sound file is .ra as shown in the javascript. But I'm not sure whether I should have the page reload or to have an iFrame open the soundfile. I'm using a recycled script. Also the embed must be in the form right?

  • #4
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    No the embed doesn't have to be in a form. Try something like this. Place this where you want the player to appear.
    Code:
    <span id="thesound"></span>
    Try this for your script
    Code:
    function go(action) {
    	//var BaseUrl = "http://www.audio-bible.com/bible/";
    	var BaseUrl = "http://www.audio-bible.com/cgi-ab/hurl?f=/ab/audio/kjv/";
    	var theForm = document.forms["myForm"], query = "";
    	query +=  "" + theForm.Book.options[theForm.Book.selectedIndex].value;
    	query += "_" + theForm.Chapter.options[theForm.Chapter.selectedIndex].value;
    	query += ".ra";
    	theForm.url.value = BaseUrl + query;
    
    
    	if(action == "refresh") {
    		self.location.href = "listenspokes.asp?" + "book=" + (theForm.Book.selectedIndex + 1);
    
    	} else {
    		ifrVerse.location.href = "listenspokesresp.asp?" + "book=" + (theForm.Book.selectedIndex + 1) + "chapter=" + theForm.Chapter.selectedIndex<%'+ query%>;
    
    	}
    document.getElementById('thesound').innerHTML = '<embed src="'+BaseUrl + query+'" width="376" height="32"></embed>'
    }
    Please note that real audio files probably aren't the best file type for the web since not many users have Real Player installed on their system.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •