-
Content Count
146 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout mortalc
-
Rank
Member
Previous Fields
-
Languages
JavaScript, and trying to get my head around AJAX.
Contact Methods
-
Website URL
http://
-
ICQ
0
Profile Information
-
Location
Right behind you...
-
I looked at the HTML5 tutorial recently and noticed the "canvas" tag. I did a quick google and it has been heralded by many as the replacment of Flash. However, there is not nearly enough information to merit that. I also discovered many amazing webpages using canvas, so I would think it would be a good idea for a tutorial.
-
I thing fromCharCode would be a good idea, but you can't use switch on a number, so it would be less efficient.
-
I didn't use an iframe this time. I used the SVG file on its own.
-
Gah. Ok, I need someone who is skilled at SVG to tell me why this isn't working: <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN""http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" version="1.1"xmlns="http://www.w3.org/2000/svg"onkeypress="move()"onload="move()"><script type="text/javascript"> <![CDATA[ var x; var y; function move() { x = new Number(svg.getElementsByTagName("circle")[0].getAttribute("cx")); y = new Number (svg.getElementsByTagName("circle")[0].getAttribute("cy"));
-
I've just discovered that you can include JavaScript in SVG! This is good news!
-
it's still not working...I think now a problem in my XML DOM syntax. Here is my modified code:<!DOCTYPE HTML><html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="LoadSVG.js"></script> <script type="text/javascript" > var balls = loadSVG("ball2.svg"); function moveLeft() { var x = balls.getElementsByTagName("circle")[0].getAttribute("cx"); var z = new Number(x); z--; x = z.toString(); balls.getElementsByTagName("circle")[0].setAttribue("cx", x);
-
I suspected as much (about the third point) - I think you're right about the iframe not updating. I just did some research and the iframe object has a reload function. so thankyou!
-
Gah! Debugging time again.HTML page: <!DOCTYPE HTML><html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="LoadSVG.js"></script> <script type="text/javascript" > var balls = loadSVG("ball2.svg"); function moveLeft(obj) { var x = obj.getElementsByTagName("circle")[0].getAttribute("cx"); var z = new Number(x); z--; x = z.toString(); obj.getElementsByTagName("circle")[0].setAttribue("cx", x); } function moveRight(obj) { var x = obj.getElementsByT
-
Ok, to make sure I understand it: If I use this code, and type in a, some code will run, but if I type in, say, b, some other code will run: <script type="text/javascript">function check(){if(event.keyCode=="a"){//execute some code}else{//some other stuff}</script><input type="text" onkeypress="check()"/>
-
Ok, Is there a way to detect a specific key press?I have thought about it, and I think there are two possibilities: Detect a keypress in general (i.e. with onkeypress or $(selector).keypress()), and execute a function, which identifies the key pressed, and then executes another function if the key is the intended one. Have a custom event, so to speak
-
I don't know if this is the right place to ask about SVG, but here goes.I've created this code for a circle moving up and down in a square. But for some reason, it isn't moving. <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN""http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" version="1.1"xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" height="500" width="500" style="stroke-width:1; stroke:black; fill:white"></rect><circle cx="250" cy="50" r="50" stroke="red" stroke-width=