Jump to content
  • Advertisement
Sign in to follow this  

Moving images within images

This topic is 3715 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I am trying to move a counter on a board, which is seen within a browser. I have written the following test code, where x and y are generated by the server and passed to function draw_circles(x,y). The code is not complete, but it does not load properly. The browser hangs before it displays anything. I believe the problem is that you can’t call the CSS more than once on a form. In this code, I am calling it once a second. Any better ideas for allowing me to move a counter around a board image. Regards Lawrence <html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 6.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Test</title> <style type="text/css"> body {} #map {position:relative; width:200px; height:200px; margin:0} </style> <script type="text/javascript"> function draw_circles(x,y) { document.write('<style type=text/css>'); document.write('#map#Red_Counter{position:absolute;top:'+x+'px; left:'+y+'px;}'); document.write('</style>') } </script> <script type="text/javascript"> function loadGame() { var xmlHttp; var timerId = setTimeout("loadGame();", 1000); try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(param); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { } draw_circles(xmlHttp.responseText.slice(0,1),xmlHttp.responseText.slice(1,2)) } } xmlHttp.open("GET",'Waiting_Server.asp,true) xmlHttp.send(null); } </script> </body> </html> [Edited by - lawrenceh on April 23, 2008 9:01:24 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!