Reputation: 1289
function HandleFileButtonClick(val)
{
var ss=val.name;
var n=ss.split("choiceimgs");
alert(n[1]);
document.forms["addpoll"]["choiceimg" + n[1]].click();
}
In the above coding it holds the variable value upto n[1]. The alert shows a number. If the line works then it will click a file input and the browser window will open.
This works fine in chrome, but in IE8 is not working. How to write the above line in IE8. And also document.forms['addpoll']['choiceimg'+i].style.display='';
this line also not working in my page. I tried the whole day to fix this. But I can't find any solution. Anyone can help me to solve this issue. Thanks in advance
Upvotes: 0
Views: 828
Reputation: 3948
Because no examples are available I assume that the code line
document.forms["addpoll"]["choiceimg" + n[1]].click();
points to a form field. If so then you have to change it into follows:
document.forms["addpoll"].elements["choiceimg" + n[1]].click();
I am not sure to 100 perscent that the concatenation of .click()
is correct, though the change to
document.forms['addpoll'].elements['choiceimg'+i].style.display='';
By the way I recommend the explicit use of value none
and display
, so you can exclude a source of error.
Upvotes: 1