Jump to content
WorldKaoss

Ajutor cu functie javascript

Recommended Posts

Posted

Am asa:

<script type="text/javascript">

var ScreenWidth=screen.width;

var ScreenHeight=screen.height;

function RandomImgNumber(){

var ImageNumber=Math.floor(Math.random()*10);

if (ImageNumber = 0){

ImageNumber = ImageNumber + 1;

}

}

</script>

<script>

document.write('<A HREF="#" onmouseover="document.Image.src=WorldKaossMO0' + ImageNumber + '.png; RandomImgNumber();" onmouseout="document.Image.src=WorldKaoss.png">');

document.write('<IMG SRC="WorldKaoss.png" NAME="Image" BORDER="0" WIDTH="' + ScreenWidth + '" HEIGHT="' + ScreenHeight + '">');</script>

</A>

Bineinteles, asta a fost scris cu tutoriale in fata, pentru ca cunostintele mele de Javascript sunt .. ahm ..

Ce ar trebui sa faca:IMG tagul are atributul source default "WorldKaoss.png", de fiecare data cand faci mouseover peste IMG/A se executa functia RandomImgNumber() care alege un numar intre 0-9 (dar if-ul este pentru a transforma din 0 in 1, ca nu am asa multe fisiere).

Problema:Se pare ca nu merge. Cand am facut in php acelas lucru a mers perfect, dar in PHP nu pot sa fac sa aleaga random number la fiecare mouseover, pentru ca ar trebuit sai dau refresh la pagina, si AJAX nu pot coda (..daca nici JavaScript nu pot)Poate cineva sa verifice acest cod sa-mi spuna ce e gresit?Multumesc

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...