Catching Keypress In Canvas Tag
Jun 22, 2006
I am trying to catch keypresses in my canvas tag, but it appears that
that is not valid.
I may try to just create a hidden input box that will allow me to catch
keypresses.
I am trying to write a very simple asteroids game for a presentation on
Ajax in July, to show that javascript can do more than it was able to a
couple of years ago.
View 3 Replies
ADVERTISEMENT
Jul 12, 2011
I want to delete some lines on the canvas that i have created in HTML5 (with the <canvas> tag). I know one solution and that is using clearRect() (give this function the HEIGHT and WIDTH of the canvas and you clears the whole canvas.).But i don't want to clear the whole canvas, i only want to delete a few lines made by the function lineTo().
View 1 Replies
View Related
Mar 16, 2009
I have a menu in which is applied typeface script. Typeface 0.11 version doesn't support hover on links. There is an experimental version but doesn't work very well for me, so i tried to implement hover by myself.
Problem is: hover works pretty well changing canvas context property fillColor and then calling fill(), but the stroke on hovered voice remains on another color. Difficult to explain, so i put some test code online: TEST CODE As you can see, passing with mouse on the menu voices triggers the hover and the element change, but remains bordered in red.
[Code]...
View 5 Replies
View Related
Jul 23, 2002
Has anyone tried working out this one?
How to detect IE4 without wrongly detecting IE5.0 (IE5.0 usually returns a navigator.appVersion of 4.0)
Here's the code im working with using substring of IE version:
// <head>
<script language="JavaScript">
this.version = navigator.appVersion;
</script>
// <body>
<script language="JavaScript">
if (navigator.appName == "Microsoft Internet Explorer"){
if (version.substring(0,1) <= 4){
if (version.substring(22,23) <= 4){
document.write("This Browser is IE4 or lower!");
}
else{
document.write("This Browser is IE5 or higher!");
}
}
}
else{
document.write("This Browser isn't IE!");
}
document.write("<br>This Browser is " +version);
</script>
The version string usually return's something like this:
4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Can anyone see any problem with using this method?
View 2 Replies
View Related
Sep 18, 2009
Is there a way to catch when a div content is updated through javascript? I update a div content through rjs and I need to call tablesorter every time the div is updated.
View 3 Replies
View Related
Apr 18, 2005
Can I get information from other frame, like form values or variables?
View 5 Replies
View Related
Jul 23, 2005
I have a main page ('index.php') with an iframe ('mainframe') on the
left hand side. All the links on the index page load a new page of
mainly text content into the iframe.
All pretty straightforward, but I am using some javascript to launch
and hide a floating div on the index page (if I launch it in the
iframe, it will be restricted to the height and width of that frame).
The code to show / hide the div is located on the page index.php - say
the function is called 'showMe()', I would call top.showMe() to launch
the div.
The Div works fine, but when I try and catch an event via:
event.srcelement
it returns the error message 'object required', because it is being
passed from a link on a totally seperate page (the iframe)...
Is there any method for the main page (index.php) to catch the event
on 'mainframe' that triggers the div ?
The div's do show up and hide, and I can load source content into them
- only error messages keep flashing up on IE (but not on Netscape /
Firefox, etc).
View 1 Replies
View Related
Jul 15, 2011
How may I catch all postback events which are triggered by all controls using jQuery in an ASPX page?
I am using the below provided code and displaying an alert window when any control posts back to the server, however not all postbacks are getting caught by the highlighted code.
protected void Page_Load(object sender, EventArgs e)
{
if (Request.ServerVariables["REQUEST_METHOD"] == "POST" || Request.ServerVariables["REQUEST_METHOD"] == "GET")
[Code].....
View 2 Replies
View Related
Oct 1, 2009
I want window.onerror type functionality in webkit.
Is there any way of doing this?
My best attempt was:
Code:
Which breaks Chromes console, but doesn't get triggered for internal errors (e.g. reference errors).
I'm trying to implement a php style __autoload.
Essentially I think it's possible to
-Catch the error
-Find out the name of the object which isnt referenced
-Try to include a JS file with the same name
View 1 Replies
View Related
Apr 1, 2009
I have a page contained in an iframe. The page contained in the iframe shows videos all the time.Each video has an id that changes when a new video is played.I need to be able to catch this changing id in the page that has the iframe (the parent page) and that is hosted in a different server from the contained page.The only languages that can be used in the contained page are javascript, ajax and jquery
In the parent page you can use these languages + php.
I'm not posting the contained page code just because, believe me, it's humongous,full of variables and functions from other files and modules.The only thing needed there is a variable, myid, that stores the new id when a new video is played.Then I have to post, send, throw ... etc. myid and after that catch it in the parent page, remembering that myid's value changes when a new video is played and that.I have to get that new value at all times.I have to get the value of the playing video id to do things like changing the background of the page depending on the video played or showing a webpage depending on the video played ... and so on.
View 2 Replies
View Related
Jan 11, 2010
I'm sure someone has written about this, but my google-fu is utterly failing me!Say I make an ajax request:
javascript Code:
Original
- javascript Code
errQueryFailure = new Error ("Server query failure");
[Code]...
View 3 Replies
View Related
Jul 2, 2009
This is the code I am using to test this. In FF and Op. When I click on an option in the select box, the alert pops up. In IE and Chrome, it doesn't seem to catch it at all.
$('.clickopt').mousedown(function(){
alert("test");
});
View 2 Replies
View Related
Mar 19, 2011
Catching <a> link click - Fancy Box I have an example here of the simple image gallery I'm working with. The thumbnails are loaded from an XML and are linked to larger images. untitled I want to use Fancy box Fancybox - Fancy lightbox alternative to show the larger images. I have fancy box working on other sites but can't get it to work here. In an attempt to work out why it's not working I tried to capture the click on the <a> link, but that won't work.
[Code]...
View 3 Replies
View Related
Dec 10, 2009
It would be easier to explain this if you play mafia wars (or any game that includes intra-game exchange of gifts/items between members) but the actual scripting doesn't require any knowledge of the game.
Background Information
Mafia Wars is a game on Facebook (and myspace, yahoo etc.) that among other things allows its players to send gifts to each other. Now because different people end up with more things of one type and are short of things of another type, the players have evolved a trading dynamic. Where x number of Item 1 is traded for y number of Item 2. A simple marketplace. And with this territory come scammers.
Essentially a player who doesn't go through with his end of the deal. good player sends item to bad player. bad player removes good player from mafia and blocks him for ever contacting him through his facebook profile. This has given rise to my group, among many others, that lists these scammers (identified with their facebook profile ids) as they are reported every day. Now over time the list has grown and it has become difficult and unrealistic to expect people to know who is on the list and who is not.
The Requirement
A javascript bookmarklet (there are many already servicing different needs of the players) that sits on the browser and tells the user if the person he is about to trade with is a listed scammer or not.
The Breakdown
The user will click the bookmarklet when he is on the facebook profile of the person he is about to trade with. When clicked the script will pull the facebook profile id from the current page, and then scan a text file located on a third-party server and return with a pop-up box message that reports if the id is listed as a scammer or not.
View 6 Replies
View Related
Aug 3, 2011
If visual basic and firebug doesn't show me any error and if code doesn't work on any browser...so what should i do. I did a little boring - to read my code again to find a simple syntax errors like - writte() for exemple.
But even that does not give me anything! Is there any good recomendations how to change it all?
Look at this code:
Browser gives me out only - Please enter a valid name
View 1 Replies
View Related
Sep 23, 2010
So I created a custom rule following numerous examples out on the web for a dynamic text input, but for some reason it seems to be letting spaces through even though my regexp tests out ok to not match when the value is any combination of spaces...
$.validator.addMethod("noSpace", function(value, element){
return this.optional(element) || /^[a-z0-9][a-z0-9_ ]{0,70}$/i.test(value);
}, "Please enter a name starting with either a letter or a digit.");
$('#form').validate({
rules: {
[Code]...
The odd thing is, it will work if you type in a space followed by a character, but if you type in one space, or one space followed by x number of spaces, it just lets it through like it's valid. But yet when I look at the demos and examples that I pulled this from, they never let those scenarios go through.
[Code]...
View 5 Replies
View Related
Jul 20, 2005
As the subject says it, is there a way to simulate a special keypress in JS
? In my case, on loading an HTML page, i'd like to set the cursor at the end
of the input text of an <input type=text ...> object. focus() sets the cusor at the beginning Any idea ?
View 2 Replies
View Related
Jul 20, 2009
Is it possible to change the part of the URL after a # symbol using javascript (and not anchor tags)?
ie. is there a way to change with a javascript function/event?
Is it compatible with major browsers?
View 2 Replies
View Related
Apr 28, 2010
I would like to increase my table row when users hit enter. find my html code below.
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" id="tblSample">
<tr>[code]......
View 8 Replies
View Related
Jun 18, 2003
DOM2 does not provide a key event module. (http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-eventgroupings-keyevents) That's fine. I'm down with that.
According to the DOM3 Events spec (http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-KeyboardEvents-Interfaces) (in last call), there's no keyPress event, only keyDown and keyUp. Instead (I guess) they've defined a new interface for text events (http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-TextEvent), which provides one event type: textInput.
Should I not code event handlers for keyPress events if I wish to write DOM-compliant scripts? IE & Moz both register a keyPress; I'm sure that it won't be outphased. I worry instead about a new and better browser appearing and balking on my script because it's coded exactly to spec.
View 1 Replies
View Related
Nov 7, 2005
I have a text box where the user enters their employee email address.
What I want to occur is when the @ sign is pressed it will
automatically add the rest (ie. mycompany.com)
I know the code required to alter the value of a text box but I dont
know the event trigger or code to detect the keypress.
View 8 Replies
View Related
Jul 20, 2005
I have:
<div onkeypress="go(event)">...</div>
and:
function go(event) {
alert(event.keyCode);
}
but I always get 0 for the keycode.
View 3 Replies
View Related
Sep 4, 2010
I need to assign a key in the javascript to actually make the javascript work,.I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys.i want to declare the key or keycombo in the script itself .,.
the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using[url]....So I want it to work it this way .,
select the text ,press a key and it opens a new tab (or window) with an xact search .,.i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using [url].... So I want it to work it this way .,
select the text ,press a key and it opens a new tab (or window) with an xact search .,.
View 6 Replies
View Related
May 12, 2010
Is there any way to detect a key being pressed in the window? I have tried the following but it doesnt work:
document.onkeyup = KeyCheck;
function KeyCheck()
{
var keyID = event.keyCode;
alert(keyID )
}
View 3 Replies
View Related
Apr 8, 2010
Ive scoured the internet for scripts that make a <div> follow the mouse, and have found one that seems to work well. However, I want the <div> to stop moving when the CTRL or the SHIFT key is pressed, I dont care which. Hopefully, I can have a div that follows the mouse at an offset that contains some click-able items, so a menu is always by your mouse. Ive tried now more than a few times to put together a piece of code that can achieve this, but none have worked. Can somebody write a script that can achieve this, or point me in the right direction?Current JS for mouse follow:
var divName = 'mouseFollow'; // div that is to follow the mouse
// (must be position:absolute)
var offX = 15; // X offset from mouse position
[code]....
View 3 Replies
View Related
Jul 23, 2005
How do I capture the keycode inside a <textarea> in NN6+ and IE5.5+? I don't
want to add add document.keyPress function because I only want this to
occure when a specific textarea is selected and not fire for every keypress
in the entire document.
<textarea onkeypress="captureKeys();"....
but I cannot get a reference to the current event so i can ask for the
keyCode. In IE I can check the event.keyCode inside my function captureKeys
but this is not possible in NN6+.
View 1 Replies
View Related