...

View Full Version : javascript in embed src=""



gilgalbiblewhee
07-05-2006, 11:24 PM
Is it possible to use Javascript to write the <embed></embed> object? If so I need the bold part written in the embed src.

<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%>;

}

}

//-->

<embed src="?" width="376" height="32"></embed>

_Aerospace_Eng_
07-05-2006, 11:29 PM
I'm not to sure how well this will work.

<embed src="" width="376" height="32" id="theembed"></embed>

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?

gilgalbiblewhee
07-05-2006, 11:37 PM
I'm not to sure how well this will work.

<embed src="" width="376" height="32" id="theembed"></embed>

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?

gilgalbiblewhee
07-05-2006, 11:45 PM
http://i.domaindlx.com/wheelofgod/listenspokes.asp

_Aerospace_Eng_
07-05-2006, 11:51 PM
No the embed doesn't have to be in a form. Try something like this. Place this where you want the player to appear.

<span id="thesound"></span>
Try this for your script

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum