tags:

views:

241

answers:

1

Hi;

Moz say's everything is ok! IE say's object expected everywhere..

for example this my make a box function (in all.js file);

function kutuyap(Eid,iduzan,text,yer,ekle){

var div;
 if (document.createElement && (div = document.createElement('div'))) {
  div.name = div.id = Eid+iduzan;
  document.getElementById(yer).appendChild(div);

  }
 //$('#'+yer).append("<div id="+Eid+iduzan+"></div>")


 $('#'+Eid+iduzan).addClass("minikutu");
 $('#'+Eid+iduzan).html("&nbsp;"+text+'<span id='+Eid+'y'+iduzan+' class="yokedici">X</span>');
    $("#"+Eid+'y'+iduzan).attr("onclick","kutusil('"+Eid+"y"+iduzan+"','"+iduzan+"','"+ekle+"');");
 $('#'+ekle).val($('#'+ekle).val()+Eid+'-');

}

and after that i call function like this;

HTML;

  <select name="Mturs" class="inputs" id="Mturs">

    <option value="0" selected="selected">Choise One</option>
    <option value="4">Pop</option>
    <option value="3">Pop-Rock </option>
    <option value="5">Rock (Yabancı)</option>

  </select>

<input name="secMtur" id="secMtur" value="" type="hidden">

 <script>
 $('#Mturs').live('change', function() {

 $('#Mturs :selected').each(function (i) {

          if ( $('#Mturs :selected').val() != 0 ) {

 secMturde=$('#secMtur').val().indexOf($('#Mturs :selected').val()+'-');

splitter=$('#secMtur').val().split("-")
if(splitter.length<=12){

if (secMturde<0) {
 kutuyap($('#Mturs :selected').val(),'mtur',$(this).html(),'divmtur','secMtur');
 }else{
   alert("Choisen before")
 }

 }else{
     alert("Max limit is 12 !")
   }

}
});
});
 </script>

sory for my realy bad english..

edit: and i have this tags;

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"&gt;
</script>
<script type="text/javascript" src="alljs.js"></script>
A: 
$("#"+Eid+'y'+iduzan).attr("onclick","kutusil('"+Eid+"y"+iduzan+"','"+iduzan+"','"+ekle+"');");

Don't use attr to set event handlers like onclick, it won't generally work in IE.

It's also a really bad idea to be creating JavaScript code from strings in that way, too. Especially as if any of those variables can include a ', ", \, &, < or U+2018/2019 character you've got trouble.

Instead use inline function expressions, picking up the variables you already have from the outer function using a closure:

$("#"+Eid+'y'+iduzan).click(function() {
    kutusil(Eid+'y'+iduzan, iduzan, ekle);
});

Again:

$('#'+Eid+iduzan).html("&nbsp;"+text+...

If text can contain </& you've potentially got cross-site-scripting problems there. Don't stick HTML strings together from text content. Use .text(text) to write plain text to an element.

if (document.createElement && (div = document.createElement('div'))) {

There is no need for this checking. document.createElement exists in every browser (it is DOM Level 1 Core) and can never return null.

div.name

There's no such property on divs.

bobince
ok i made a test page with my code and IE says nothing(no more object expected error) also do nothingand change my code like this..but nothing change..http://www.yetkineren.com/testpage.html
Yetkin EREN
You appear to be using jQuery 1.3. `live` change events don't work in IE under this version of jQuery. Either change to 1.4, or replace `.live('change', ...` with a normal `.change(...` binding. (You don't appear to be doing anything that requires `live` binding.)
bobince