Błędna interpretacja skryptu javascript

Forums » Forum Opery » Strony WWW w Operze

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

19. April 2010, 20:21:43

Tetriando

Posts: 1

Błędna interpretacja skryptu javascript

echo '<script type="text/javascript">
 
var max_width = 350;
var max_height = 350;

function resize_image(img) {

if(img.width > img.height){
    if(img.width > max_width) {
        factor = img.width / img.height;
        height = Math.floor(max_width / factor);
        img.width = max_width;
        img.height = height;

        var newdiv = document.createElement(\'div\');
        newdiv.className = \'resize_image\';
        newdiv.innerHTML = \'<a href="\' + img.src +\'" onclick="this.target=\\\'_blank\\\'"><img src="\' + img.src +\'" height="\' + height +\'" width="\' + max_width +\'" alt="" title="Kliknij aby powiększyć."></a>
<p style="width:\' + max_width +\';">Kliknij na obrazek aby go powiększyć.</p>\';
        img.parentNode.insertBefore(newdiv, img);
        img.parentNode.removeChild(img);

    }

}

else{
    if(img.height > max_height) {
        factor = img.height / img.width;
        width = Math.floor(max_height / factor);
        img.height = max_height;
        img.width = width;
		
		var newdiv = document.createElement(\'div\');
        newdiv.className = \'resize_image\';
        newdiv.innerHTML = \'<a href="\' + img.src +\'" onclick="this.target=\\\'_blank\\\'"><img src="\' + img.src +\'" height="\' + max_height +\'" width="\' + width +\'" alt="" title="Kliknij aby powiększyć."></a>
<p style="width:\' + max_width +\';">Kliknij na obrazek aby go powiększyć.</p>\';
        img.parentNode.insertBefore(newdiv, img);
        img.parentNode.removeChild(img);
		
    }

}
} 

</script>'; 



Na firefoxie i chrome działa, na operze i ie 8 nie

20. April 2010, 00:22:46 (edited)

smqzbq

Posts: 101

a mógłbyś dać ten skrypt działający na FF na konkretnej stronce a nie wycięty z php?p na ktorej operze to nie dziala? -ps w kazda opere wbudowana jest konsola js to mógłbys podać w sumie co opera wypisuje.
Bring back statistics for blogs on my.opera.com!
http://my.opera.com/community/forums/topic.dml?id=1139042
Please VOTE and tell your friends! smile wizard

Przywróćmy statystyki dla blogów na my.opera.com!
http://my.opera.com/community/forums/topic.dml?id=1137502
Proszę o głosy smile wizard

20. April 2010, 16:48:22

nowotny

Posts: 1296

Originally posted by Tetriando:

Na firefoxie i chrome działa, na operze i ie 8 nie


Hmm... U mnie działa bez problemu... Co ci KONKRETNIE nie działa...?

Forums » Forum Opery » Strony WWW w Operze