This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
开发者_如何学编程Closed 8 years ago.
Improve this question"Object doesn't support this property or method"
It's this line.
pthumb = $("#pthumb").attr("src");
Does anyone know why?
You have a javascript variable called "pthumb" and a DOM element with the id "pthumb", and IE's JS engine could be trying to use the wrong one.
If you have a function also called "pthumb" then IE could also be trying perform this action on the function object.
The last thing to try is to make sure you are using "var" when declaring "pthumb" in the Javascript. i.e.:
var pthumb = $("#pthumb").attr("src");
Are you ensuring the DOM is ready?
$(document).ready(function(){
//wrap your code in document-ready check
pthumb = $("#pthumb").attr("src");
});
you could double check the plain javascript method:
var jthumb= document.getElementById('pthumb').attributes['src'].value;
try{
pthumb = $("#pthumb").attr("src");
}
catch(er){
alert(er.message + '\n'+jthumb)
}
If you don't catch the error, the element is not yet ready.
精彩评论