/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Javascript code dowsn’t work in IE7

I have a webpage which to used work just fine in IE6, but since IE7 came out, many of my site users started complaining that some button are not functioning at all.

The webpage shows and plays audio clip for students, and then the student can record his/her voice.

The play/Pause/stop buttons for playing the audio file works just fine.

but the buttons for recording area (stop/pause/replay), and after you click record button will not respond at all, except for one case, if the student right-click on the button and choose open link.

This is happening only in IE7.

[COLOR=”Red”][B]This is the code for the first audio file [/B][/COLOR]
//Open the audio
function openit(fn, sam_au, userID){
document.getElementById(‘speedocx’).SetValue(100);
if (sam_au.toLowerCase().indexOf(“.wav”,0)>0) {
AudioSample=sam_au;
}
else{
AudioSample=””; }

if (fn.toLowerCase().indexOf(“.wav”,0)<=0){
alert(“Error: Audio file cannot be found. Please try refreshing the page. If the problem persists contact [email][email protected][/email].”);
return;
}
document.getElementById(‘amocx’).remotefile = fn;
document.getElementById(‘amocx’).getfile();
studentfilename = userID + fn;
}

//Play the teacher audio
function playit(){
if (document.getElementById(‘amocx’).filename == “” || document.getElementById(‘amocx’).filename==null) {
alert(“The audio file was not initialized properly. Please try to refresh. If the problem persists, please contact [email][email protected][/email].”);
}
else {
document.getElementById(‘amocx’).fileload(document.getElementById(‘amocx’).filename);
document.getElementById(‘amocx’).SetPlayRange();
document.getElementById(‘amocx’).setspeed(document.getElementById(‘speedocx’).value/100);
document.getElementById(‘amocx’).playit();
}
}

//Pause the teacher audio
function pauseit(){
document.getElementById(‘amocx’).pause();
document.getElementById(‘amocx1’).pause();
}

//Stop the teacher audio
function stopit(){
document.getElementById(‘amocx’).stopit();
document.getElementById(‘amocx1’).stopit();
}

[COLOR=”Red”][B]This is the code for the Recording[/B][/COLOR]

//Record the student audio
var is_re;
function recordit(){
document.getElementById(‘rmocx’).dostop()
is_re=1;
document.getElementById(‘rmocx’).style.height=138;
document.getElementById(‘amocx1’).style.height=0;
document.getElementById(‘amocx1’).stopit();
if (document.getElementById(‘rmocx’).DevHandle == 0){ document.getElementById(‘rmocx’).beginit(); }
document.getElementById(‘rmocx’).dostart();
}

//Play the student audio
function playit1(){
document.getElementById(‘rmocx’).dostop()
document.getElementById(‘amocx1’).stopit()

if (document.getElementById(‘amocx1’).filename==””||document.getElementById(‘amocx1’).filename==null){
alert(“Please record first!”);
}
else{
document.getElementById(‘amocx1’).fileload(document.getElementById(‘rmocx’).sfile);
document.getElementById(‘amocx1’).SetPlayRange();
document.getElementById(‘amocx1’).playit();
}
}

//Stop the recording for the student audio
function stoprecord(){
if (is_re==0){document.getElementById(‘amocx1’).stopit();}
else {
is_re=0;
document.getElementById(‘rmocx’).dostop();
document.getElementById(‘rmocx’).style.height=0;
document.getElementById(‘amocx1’).style.height=138;
document.getElementById(‘amocx1’).filename=document.getElementById(‘rmocx’).sfile;
document.getElementById(‘amocx1’).openit();
}
}

//Pause the student recording
function pauserecord(){
if (is_re==0){document.getElementById(‘amocx1’).pause();}
else{ document.getElementById(‘rmocx’).dopause(); }
}

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@toicontienDec 05.2007 — There's nothing that jumps right out and says "I am an error." Can you post the HTML you are using too? What's best would be a link to the live page. It might be a compatibility issue between IE6 and 7. Also, what plug-in are you using for the sound recording and playback? Windows Media? Quicktime?
Copy linkTweet thisAlerts:
@hmasamraauthorDec 10.2007 — Hi all,

I have included the page link to see i what i mean that this page works fine with IE6 but not IE7.

http://www.linchomestudy.ca/online/Record.aspx?exeID=1202&partID=2052&levelID=3726&courseID=279&levelGroup=4&queID=212&exNum=1

To be able to use this page you have to download this recording/playback software it's only 1.8 MB in size and it's safe, here is the link:

http://www.linchomestudy.ca/online/systemRequirements/download/packageall.exe


Any suggestions are welcome
Copy linkTweet thisAlerts:
@FangDec 11.2007 — All browsers have a problem with this line:document.getElementById('speedocx').SetValue(100);
Copy linkTweet thisAlerts:
@hmasamraauthorDec 11.2007 — Thank you Fang.

But as I mentioned, it works perfectly in IE6 and older versions, but when my clients started to update their browser to IE7 or bought new PCs with VISTA and IE7 installed, i've started to receive complaints about buttons in RECORDING area not working, and what is interesting is that, if you right click any of these buttons and choose 'Open Link' , it will work!!!!!

So, I'm really in a Limbo
Copy linkTweet thisAlerts:
@TJ111Dec 11.2007 — <i>
</i>//Stop the recording for the student audio

<i> </i>function stoprecord(){

<i> </i> if (is_re==0){document.getElementById('amocx1').stopit();}

<i> </i> else {

<i> </i> is_re=0;

<i> </i> document.getElementById('rmocx').dostop();

<i> </i> document.getElementById('rmocx').style.height=0;

<i> </i> document.getElementById('amocx1').style.height=138;

<i> </i> document.getElementById('amocx1').filename=document.getElementById('rmocx').sfile;

<i> </i> document.getElementById('amocx1').openit();

<i> </i> }

<i> </i>}

I don't see any prototyping of the DOM, so functions like dostop() and stopit() aren't properties of any HTML elements. Since these functions are all

anonomyous, ie. you don't need to pass any variables, they all operate on a specific element in the DOM, there's no need to pass them as properties, just call them by themselves. Also, you might just want to update this whole script, checking for IE4 and NN4 seems a little out of date.
<i>
</i>IE4=(document.all)?1:0

NN4=(document.layers)?1:0

if (IE4) setInterval('KB_keepItInIE("KBStatic",400,10)',1)

if (NN4) setInterval('KB_keepItInNN("KBStatic",400,10)',1)
×

Success!

Help @hmasamra spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...