While programming my gallery I've stumbled opon some very strange problems.
To get a better view into the execution of my code I've "written" (copy and paste) a pause function. Now I think I might have found my troublemaker: my sourcecode seems to run backwards!
With "pause" I've found these problems / this problem:
Here is a short part of my code that troubles me:
function pause(milliseconds) { var dt = new Date(); while ((new Date()) - dt <= milliseconds) { /* do nothing */ } }
I am just getting startet with jQuery and OOP so please excuse me if I am asking the obvious.
Here is my problem: While I am trying to programm my own gallery, I got stuck at one part, here is what my code looks right now:
<html>
...
<div id="content">
<img src="pictures/namibia/01.jpg">
</div><!--END OF CONTENT-->
...
</html>
----------------
In jQuery:
...
imagePath = $("#content img").attr("src"); --> works like a charm!
...
...
$("#content img").attr("src") = imagePath; --> doesn't work at all.
...
All I get is an error message from my Visual Studio: Runtime error in Microsoft JScript: Can't be assinged to a result of a function. (Not sure if this is the exact translation, here is the original message: "Kann dem Ergebnis einer Funktion nicht zugewiesen werden")
I am quite puzzled why that is.
I already dubblechecked my "imagePath" variable, its content is OK, as it holds my desired "pictures/namibia/02.jpg"
By the way: these lines of code work great - if clicking the image that is, what is not what I am looking for ...
$(document).ready(function()
{
$("#content img").click(function()
{
this.src = imagePath;
});
});
So here I am, hoping for your help.
Thank you very much in advance, have a nice day all!