Jump to content

Fire Dragon

Members
  • Posts

    159
  • Joined

  • Last visited

Posts posted by Fire Dragon

  1. Well,like usual I made something wrong :) My picture don't change it's location.I understood that absolutely location thing,but looks like,that I have problems with mix it with keyboard code.So what is now wrong?Here is my code:

    <html><head><title>JavaScript key press event</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><script type="text/javascript">document.onkeyup = KeyCheck;       function KeyCheck(e){   var KeyID = (window.event) ? event.keyCode : e.keyCode;   switch(KeyID)   {case 16:      document.Form1.KeyName.value = "Shift";      break;       case 17:      document.Form1.KeyName.value = "Ctrl";      break;      case 18:      document.Form1.KeyName.value = "Alt";      break;      case 19:      document.Form1.KeyName.value = "Pause";      break;      case 37:      document.Form1.KeyName.value = "Arrow Left";      break;      case 38:      document.Form1.KeyName.value = "Arrow Up";      break;      case 39:      document.Form1.KeyName.value = "Arrow Right";      break;      case 40:      document.Form1.KeyName.value = "Arrow Down";      break;   }}</script><script type="text/javascript">var img = document.getElementById('img1');img.style.top = "56px";  //new location based on arrow pressimg.style.left = "49px";  //new location based on arrow press</script><img id="img1" src="lotad.gif" style="position:absolute;top:79px;left:98px" alt=""/></head><body></body></html>

    Thanks.Oooops!DOuble post!Sorry,sorry,sorry,sorry,sorry... :):(

  2. HTML
    <img id="img1" src="something.gif" style="position:absolute;top:#px;left:#px" alt=""/>

    JS

    var img = document.getElementById('img1');img.style.top = "#px";  //new location based on arrow pressimg.style.left = "#px";  //new location based on arrow press

    Ok,I think,that I little like understand,what you mean.One thing,what I want ask,detail is about those "#px"is it so,that I place pixel value after that code snippet?Like #px10"?
  3. I made timer,using code from w3schools' example,but it won't work with my game.Here is code what I try get work:

    <script type="text/javascript">var t=setTimeout("document.getElementById('ritari1').style.display="block";",1000)</script>

    As you can see,I want that image,what's ID is "ritari1" comes visible,when time is over.ID code is right,because I tested it without timer,and it works nicely.But when I put ID and timer code together,nothing happens.And timer works nicely alone too.Did I write something wrong?

  4. How I can create,that you can move something using keyboard,using example arrows?I want make picture or object,what you can move using keys.what is that code?Somekind vk_space,example?Thanks.

  5. Well,this may be little stupid question,but I learned html in school,and teacher never say how to do this,and I can't find answer in w3schools.So my question are,how put images on diffrent locations in webpage?Example these two smileys: :) -----------------------DISTANCE------------------------- :) So how?I heard something that x and y coordinates,what have something to do with this,but I don't know...Thanks.

  6. I have two questions about marquee code.So here they are:1.Can I make same kind code than <marquee>,but only vertical direction?And how?2.Do <marquee> code make something about image's transparency in Fire Fox?I made transparency image,but it was white in Fire Fox,and transparency in Opera.Thanks.

  7. Thanks,but it don't "replace" mouse cursor,like that first one,what needs permission.Well,it looks like,I must ask permission so I can use that first code.Thanks anyway.BTW,I just noticed that you can use it for personally use :) I'm sorry that I caused so much writing to you. :) Soorryyy!But it gave new idea,so thanks!

  8. Post what you have for code and I can debug it for you...I just solved the same problem (getting the mouse position in FireFox) that is most likely the cause of your trouble.

    I used just that code,what was on the website,so it is like this:
    <script>/*Cross browser cursor trailer scriptBy Brian Caputo (bcaputo@icdc.com)Written permission granted to lissaexplains.comto distribute the script for personal use. (DO NOT REMOVE THIS)*/B=document.all;C=document.layers;T1=new Array("peli_link.gif",38,35)nos=parseInt(T1.length/3)rate=50ie5fix1=0;ie5fix2=0;for (i=0;i<nos;i++){createContainer("CUR"+i,i*10,i*10,i*3+1,i*3+2,"","<img src='"+T1[i*3]+"' width="+T1[(i*3+1)]+" height="+T1[(i*3+2)]+" border=0>")}function createContainer(N,Xp,Yp,W,H,At,HT,Op,St){with (document){write((! ? "<layer id='"+N+"' left="+Xp+" top="+Yp+" width="+W+" height="+H : "<div id='"+N+"'"+" style='position:absolute;left:"+Xp+"; top:"+Yp+"; width:"+W+"; height:"+H+"; ");if(St){if ©write(" style='");write(St+";' ")}else write((?"'":"");write((At)? At+">" : ">");write((HT) ? HT : "");if (!Op)closeContainer(N)}}function closeContainer(){document.write((?"</div>":"</layer>")}function getXpos(N){return ( ? parseInt(B[N].style.left) : C[N].left}function getYpos(N){return ( ? parseInt(B[N].style.top) : C[N].top}function moveContainer(N,DX,DY){c=( ? B[N].style :C[N];c.left=DX;c.top=DY}function cycle(){//if (IE5)if (document.all&&window.print){ie5fix1=document.body.scrollLeft;ie5fix2=document.body.scrollTop;}for (i=0;i<(nos-1);i++){moveContainer("CUR"+i,getXpos("CUR"+(i+1)),getYpos("CUR"+(i+1)))}}function newPos(e){moveContainer("CUR"+(nos-1),(?event.clientX+ie5fix1:e.pageX+2,(?event.clientY+ie5fix2:e.pageY+2)}if(document.layers)document.captureEvents(Event.MOUSEMOVE)document.onmousemove=newPossetInterval("cycle()",rate)</script>

    Or do you have another samekind code,because looks like that I must ask permission before I can use this code?

  9. Okay,I need this kind pictures:1.Picture what replaces mouse cursor.How I can make?Or picture follows mouse veeeery near.2.Picture,what follows mouse,but it moves itself,and when you don't move cursor,image moves near, and near.Until it touches mousecursor.I made example with Game Maker,what I mean.It is exe file,so you can load and open it.If you want,check it first with virus scanner.Here is LINKLittle strange way to tell what means :)

  10. Well,I found one site,where is code how to set sound,when mouse is over image.I tried this before in school,when we build webpages,but it won't work and now I use Fire Fox,and it won't work with it.Well,is there samekind code,what works with Fire Fox?I know that I can make this with JS someway,but I want know,is there different ways to that with HTML.Here is code,what I found before:

    <IMG SRC="picture.gif" onMouseOver="document.all.music.src='music.au'">   <bgsound src="#" id=music loop=2 autostart="true">

  11. Do anyone know where I can find tutorial for Symbian OS programming?I saw one book about this language before in bookshop,but it was little too expensive,because I only want look and try that language.So do anyone know?

  12. Thanks,it works nicely!But do anyone know,how make pictures disappear,when variable is lower than 52?This thing isn't my biggest problems now,but it would be nice,if I can learn it :) Thanks.

  13. I have little problem about document.write code.Okay,I made little exercise code,where is two buttons.Another them increases variable,and other decreases it.So,I made it so,that when variable is "52",document.write creates image to screen.However,it appeared above those two buttons,and I can't press them!So question is,how I can control,where document.write creates picture?And one extra question,if code creates image when number is above 52,how I can set it disappear,when variable is under 52?Thanks.And last,here is my code.It contains some Finnish words,but I think that you can still understand my code :)

    <html><head><script type="text/javascript">var mutu=50function cnt(){mutu=mutu+1if(mutu == 52){document.write('<img src="lotad.gif">')}}var mutu=50function minus(){mutu=mutu-1if(mutu == 52){document.write('<img src="lotad.gif">')}}</script><script type="text/javascript">function tarkista(){document.getElementById('txt').value=mutu}</script></head><body><form><input type="button" onclick="cnt()" value="Lisää"></form><form><input type="button" onclick="minus()" value="Vähennä"></form><form><input type="button" onclick="tarkista()" value="Näytä tämän hetkinen luku."></form><form><input type="text" id="txt"></form></body></html>

×
×
  • Create New...