Why does this HTML fail in IE8/9 only when added with JavaScript?
i am using chrome. i am using a "div" with "float: left" and "float: right" buttons. The page is views in atleast all browser ( not IE8-IE9 ).
Here is Chrome, IE8-IE9 (generated with javascript), and IE8-IE9 Normal HTML code Preview. [ full image preview ] http://i52.tinypic.com/28878tk.jpg i dont know what is the problem, div css float problem or javascript problem.
here is css code:
#middleside01 {
border: 0px solid #000;
background: url(rp_images2/blue_mid.png);
width: 715px;
height: 250px;
p开发者_高级运维adding-left: 10px;
padding-right: 10px;
}
.flagbtn1 {
border: 0px solid #000;
background: url(rp_images2/country_box.png);
margin-top: 6px;
float: left;
width: 350px;
height: 45px;
}
.flagbtn2 {
border: 0px solid #000;
background: url(rp_images2/country_box.png);
margin-top: 6px;
float: right;
width: 350px;
height: 45px;
}
And here is Javascript code:
function insert_btn(im_url,id,flagid,name){
var tbl='<a style="cursor:pointer" onclick="ajax_cl(\''+flagid+','+name+'\', flagsfldr);"><div class="flagbtn'+id+'">';
if(ratepg==false){flagid='44';}
tbl+='<div class="flagbtnf"><img src="'+im_url+'large/'+flagid+'.gif" alt="'+name+'" onError="this.src=\''+im_url+'large/noimgbig.jpg\';" /></div>';
//if(name.length>=30)name=name.substr(0,25)+"...";
if(ratepg==true){
tbl+='<div class="flagbtnt rt-font">> <a onclick="ajax_cl(\''+flagid+','+name+'\', flagsfldr);" class="ft1">'+name+' ('+flagid+')</a></div></div></a>'; } else {
tbl+='<div class="flagbtnt rt-font">> <a onclick="ajax_cl(\''+flagid+','+name+'\', flagsfldr);" class="ft1">'+name+'</a></div></div></a>'; }
if(id=='2'){
tbl+='<div class="clearfix"></div>';
}
return tbl;
}
i used clearfix method, but it not works. What could the problem be?
[7:59 PM - 10-12-2011]I got my Solution by removing this from first line of javascript:
<a style="cursor:pointer" onclick="ajax_cl(\''+flagid+','+name+'\', flagsfldr);">
Thankyou so much to all. Someone said that why i use some requesting sentence. that's because i am new on stackoverflow, and it is my first question. so it happend.
Thankx again to All.
Remove extra closing ( starred part )
function insert_btn(im_url,id,flagid,name){
var tbl='<a style="cursor:pointer" onclick="ajax_cl(\''+flagid+','+name+'\', flagsfldr);"><div class="flagbtn'+id+'">';
if(ratepg==false){flagid='44';}
tbl+='<div class="flagbtnf"><img src="'+im_url+'large/'+flagid+'.gif" alt="'+name+'" onError="this.src=\''+im_url+'large/noimgbig.jpg\';" /></div>';
//if(name.length>=30)name=name.substr(0,25)+"...";
if(ratepg==true){
tbl+='<div class="flagbtnt rt-font">**>** <a onclick="ajax_cl(\''+flagid+','+name+'\', flagsfldr);" class="ft1">'+name+' ('+flagid+')</a></div></div></a>'; } else {
tbl+='<div class="flagbtnt rt-font">**>** <a onclick="ajax_cl(\''+flagid+','+name+'\', flagsfldr);" class="ft1">'+name+'</a></div></div></a>'; }
if(id=='2'){
tbl+='<div class="clearfix"></div>';
}
return tbl;
}
精彩评论