On 4/12/07, wyo <[EMAIL PROTECTED]> wrote:
Sorry, was to fast with posting, here are more questions.
On Apr 12, 12:25 am, "Jonathan Sharp" <[EMAIL PROTECTED]> wrote:
>
> You could do that too... here's another option:
>
> echo "<img align=\"center\" src=\"$f\" class=\"photo\"><br><br>";
>
That means only the first is added with PHP?
Yep, this is the only PHP.
function showPhoto() {
> this.src = this.$src;
> $(this).show();
> }
> function hidePhoto() {
> $(this).hide();
> this.$src = this.src;
> this.src = '';
> }
>
Sorry what does
this.$src = this.src;
this.src = '';
'this' is a reference to the IMG element and in JavaScript '$' is treated
like any other character so you can have a variable named $ (which is what
jQuery does). So the code just creates an attribute of the image to store
the URL to the photo temporarily and then removes the src to the image to
keep it from loading.
mean? I guess "$src" isn't PHP, is it? And does "this.src = '';"
remove the picture?
Nope, not PHP, it just removes the URL to load the picture from and stores
it as the $src attribute. It's the same as doing:
this.oldSrc = this.src;
this.src = ''; // Empty the src.
Cheers,
-js