Why can't these javascript codes working on non-IE browsers?
var current_point="url(images/step_points.png) no-repeat 0px 0px";
function init(){
show_step('1');
oCurrent('0');
}
function show_step(i){
var img=document.getElementById("s_img");
switch(i) {
case '1':
img.style.backgroundImage="url(images/zhua.png)";
img.style.right="0";
document.getElementById("steps_content").src="step1.htm";
getEle('step1_big').style.display="";
getEle('step2_big').style.display="none";
getEle('step3_big').style.display="none";
getEle('step4_big').style.display="none";
getEle('step1_cpoint').style.background=current_point;
getEle('step2_cpoint').style.background="";
getEle('step3_cpoint').style.background="";
getEle('step4_cpoint').style.background="";
getEle('step1_div').style.visibility="hidden";
getEle('step2_div').style.visibility="visible";
getEle('step3_div').style.visibility="visible";
getEle('step4_div').style.visibility="visible";
break;
case '2':
img.style.backgroundImage="url(images/xuan.png)";
img.style.right="0";
document.getElementById("steps_content").src="step2.htm";
getEle('step2_big').style.display="";
getEle('step1_big').style.display="none";
getEle('step3_big').style.display="none";
getEle('step4_big').style.display="none";
getEle('step2_cpoint').style.background=current_point;
getEle('step1_cpoint').style.background="";
getEle('step3_cpoint').style.background="";
getEle('step4_cpoint').style.background="";
getEle('step2_div').style.visibility="hidden";
getEle('step1_div').style.visibility="visible";
getEle('step3_div').style.visibility="visible";
getEle('step4_div').style.visibility="visible";
break;
case '3':
img.style.backgroundImage="url(images/xi.png)";
img.style.right="610px";
document.getElementById("steps_content").src="step3.htm";
getEle('step3_big').style.display="";
getEle('step1_big').style.display="none";
getEle('step2_big').style.display="none";
getEle('step4_big').style.display="none";
getEle('step3_cpoint').style.background=current_point;
getEle('step1_cpoint').style.background="";
getEle('step2_cpoint').style.background="";
getEle('step4_cpoint').style.background="";
getEle('step3_div').style.visibility="hidden";
getEle('step1_div').style.visibility="visible";
getEle('step2_div').style.visibility="visible";
getEle('step4_div').style.visibility="visible";
break;
case '4':
img.style.backgroundImage="url(images/ce.png)";
img.style.right="610px";
document.getElementById("steps_content").src="step4.htm";
getEle('step4_big').style.display="";
getEle('step1_big').style.display="none";
getEle('step2_big').style.display="none";
getEle('step3_big').style.display="none";
getEle('step4_cpoint').style.background=current_point;
getEle('step1_cpoint').style.background="";
getEle('step2_cpoint').style.background="";
getEle('step3_cpoint').style.background="";
getEle('step4_div').style.visibility="hidden";
getEle('step1_div').style.visibility="visible";
getEle('step2_div').style.visibility="visible";
getEle('step3_div').style.visibility="visible";
}
}
// Those codes can run on IE, but others. I can't figure out the reason. I will really appreciate helping me solve the problem. Thanks!
Hi,
I think that getEle('...') is a syntax error, and it should be: document.getElementById instead of getEle .
Additional
Originally Posted by
MarPlo
Hi,
I think that getEle('...') is a syntax error, and it should be: document.getElementById instead of getEle .
function getEle(id1){
var frame1='steps_btn';
var ele=document.frames[frame1].document.getElementById(id1);
return ele;
}
Hi,
Try replace:
var ele=document.frames[frame1].document.getElementById(id1);
With this:
var ele=document.getElementById(iframe_id).contentWindow.document.getElementById(id1);
- And use an ID in the <iframe>
Last edited by MarPlo; 07-24-2012 at 10:43 PM .
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks