Incorrect Values Of Element Positions
Oct 30, 2009
I'm developing a chess game recorder (records chess games just like electronic score sheet) and i am trying to write a function that handles the "en passent" rule in chess. However, when i try to test to see if a Black pawn is at a particular x,y location, it is always giving me back "50px". Even when it's not at that location. i uploaded semi-live version to my website here: [URL] you just click on the 'Play' button to start the game here's the function in question:
[Code]..
View 4 Replies
ADVERTISEMENT
Nov 20, 2011
I have a webpage which the user can drag a marker around inside a div and the script then shows the standard js alert box with the final positions of the marker once the user has stopped dragging it about. What I need to do is get the script to add these values to two hidden input elements in the page.
[Code]...
View 3 Replies
View Related
Apr 18, 2010
I think the offset() function returns node's position relative to document. The attached html file prints the offset value to console when the box is clicked. I expect the same value would be printed every times. However, when the script is run on iPad (with simulator), it print different value when I zoom and scroll to different position. This problem does not occurred in iPhone.
Attachments
test.html.gz
Size : 388 Bytes
Download : 505
View 9 Replies
View Related
May 28, 2010
jquery width() and height() functions are consistently returning the wrong values for the viewport size (i.e. $(window).width). Anyone know why..or what I can do to fix it?
View 3 Replies
View Related
Dec 13, 2007
I'm using height() and width() to find the dimensions of some inline images in the html. FF and IE work fine, but Opera is returning incorrect values. For example, it returns 92px as the width of an image that is actually 160px wide. How can I fix this?
View 4 Replies
View Related
Sep 7, 2010
I would like to change all img tags with a certain class on the page as follows [code]...
I do not know how to "copy" the value of the img tag src attribute to the background url attribute of the div.
View 2 Replies
View Related
Mar 31, 2010
I'm attempting to make it so it physically swaps the element position within DOM (the index, in other words) when someone clicks on a button. It will either be the element right before, or right after (depending on which button they click). I'm using jQuery, so if there is an easy way to do it using that, please let me know. If not, I can use jQuery to get the DOM elements using .get(). I don't know if I can just just do something like:
Code:
var domElements = $('.draggable').get();
var tempElement = domElements[index + 1].cloneNode(true);
domElements[index + 1] = domElements[index].cloneNode(true);
domElements[index] = tempElement;
It doesn't seem to work quite right. Should I use replaceChild or something? Don't know if it would work, here? I will know the index, so that's not an issue, here, it's just a matter of getting it to reorder the elements, so when I loop through them, they are processed in the correct order.
View 2 Replies
View Related
Dec 10, 2010
I have a javascript or CSS problem with two tables with same positions. The two tables has the same structure and positon in page.I want to view the odd lines from a table and the even lines from the oher table. What I have do is the following :
Code:
<style type="text/css">
#slideshow{
background:url('templates/images/femeielaptop.jpg');
width:666px;
[Code]....
After page loads I see just the tabel having id='slideshow'.I have expected to see odd lines from the "slideshow2" table and even lines from the "slideshow" table.
View 1 Replies
View Related
Nov 17, 2007
Interferences with scrollbars:
What would effect a scrollbar in a browser on a website?
Let me clear that up. While writing a "rain effect" script, what could interfere with the scrollbar actually not showing up on that specific webpage.
Below is the script I am working with - If in any instance someone may need to review a certain area of it. Code:
View 1 Replies
View Related
Apr 11, 2007
Is there a way to get the position of multiple substrings that match a
regexp without using closures? match() returns the substrings
themselves, not the positions, and search() seems to only return the
first position. Here's what seems to work (under Shanti Rao's jsdb.exe
shell) but I get a bit nervous about using closures Code:
View 1 Replies
View Related
Nov 14, 2008
I'm using this sortable method: [URL] Works perfect! I have one question though: When a certain action is taken by the user, I want to reset the original order of the <li>s in the list. I can't seem to figure out how to do that.
View 3 Replies
View Related
Mar 31, 2010
in a list, as seen below, i would like to first of all change the order only by clicking a button.e.g. li_elem2 and li_elem3 should change their order (positions), maybe even in a nice animated way later on...i tried to change it by editing the css properties, but didn't work out. so now i would be happy about any other approach i can take to swap items, or change positions of two list items....
<ul class="rounded">
<li class="li_elem1">Liste 1</li>
<li class="li_elem2">Liste 2</li>
[code]....
View 1 Replies
View Related
Aug 20, 2001
I have a page where you can dress someone up in silly clothes using a skeleton image, and several items of clothing as gifs in dragable layers. Code:
How can I use a bit of j'script to grab the X and Y values of each layer and then put them in to a load of hidden form fields?
I then intend on having the user click the submit button when they've put all the stupid clothes in the wrong places... and saving the results in a database.
View 1 Replies
View Related
Sep 27, 2006
I noticed weird results when using eval() to do some simple calculations. Here are a few eval() statements and the corresponding results from javascript:
eval("1.2+0.97") =2.17
eval("1.2+0.98") =2.1799999999999997
eval("1.2+0.99") =2.19
eval("1.2+0.981") =2.181
This can happen with other numbers as well, but certainly not with any combination. I have confirmed this on Firefox and Safari, two different versions of OS X and both Intel and PowerPC Macs.
View 4 Replies
View Related
Apr 21, 2010
I'm just getting into jquery and was testing to see how I could handle php/mysql errors on my ajax function page. I thought that if I set the datatype to xml and since the error page was html it would throw an error but it doesn't. How can I handle this?
View 5 Replies
View Related
Aug 24, 2009
I am pulling in an XML doc, storing it in a global var and through out the app I am transversing it to grab certain info. Up till 1.2.6 it's been working fine, but when I upgraded 1.3.2 I get bad results.
Here are my two test pages:
[URL]
My guess is the it has something to do with Sizzle but I can't place exactly where the issue may be happening.
View 1 Replies
View Related
Oct 19, 2010
However, I finally ran into a problem that I can't figure out. When I try and get the width of any cell in a table it's returning a width of 83 or 84. I have the table inside a div that has a width of 757px. I don't have a width set on the table itself, but each cell is set to 100px. I've tried to set the width in a css file and inline neither of which give me the 100px that I'm thinking it should return. I've tried both width(), outerWidth() and innerWidth(). The only one that returns a different number is outerWidth.
View 6 Replies
View Related
Dec 22, 2011
I have a global variable that I change depending on what's going on in screen.
And that function changes that variable.
For some reason, in FF, it modifies the variable as expected. But in Chrome, it doesn't.
Why is this? Is there any way to have consistent behaviour in both browsers?
In fact:
Returns true in FF, but false in Chrome...
View 4 Replies
View Related
Oct 4, 2010
Does anyone know of a place to get a code that looks at what is typed in a textbox and displays a green checkmark or a red x next to the textbox if the value entered is invalid. Eg. if no @ is entered in the email field, a red x would be shown next to the email field. Eg. if a zip code contains letters, a red x would be shown next to the zip code field. Eg. if the email field contains a @ and a period, a green check would be shown next to the email field. Etc. The green check or red x would have to be shown either as the user is typing or after they go to the next field (Blur).
View 1 Replies
View Related
Oct 11, 2011
i am using this script
Code:
<script type="text/javascript">
$(document).ready(function() {
for ($i=0; $i<4; $i++) {
var num = $('.clonedInput').length;
var newNum = new Number(num + 1);
[Code]...
all works well, less one thing. The id names of valores are incorrect in the last loop.
[Code]....
View 2 Replies
View Related
Apr 10, 2009
I should imagine others here have experienced it. The user completes your form, and they unintentionally input their email address incorrectly. Then when you reply to their form, you then get the mailer daemon returning your email! Now, there's a couple of ways that some websites try to solve this problem - some ask the user to input their email address twice, some show the forms results on the next page, so that the user has a last chance to check, before completing the submission. Are there any other ways of trying to ensure that, as much as possible, that the user inputs the correct email address?
View 10 Replies
View Related
Aug 5, 2011
Im working on some drag and drop logic similar to the jQuery shopping cart example, but I've run into a small hitch. If I double click on the LI within my 'dropped' area it causes them to become draggable again. I specifically set up drag to only work from one source list, so Im unsure how double clicking is causing this bug?
View 1 Replies
View Related
May 7, 2010
I am FAR FROM BEING KNOWLEDGEABLE about javascript. On my web page, I want to have a slideshow run that'll show small-ish versions of images. I don't want the whole thing re-displaying every time, so I put together a little javascript to figure out how to show the images.....
I have one ALERT in here to show me the dimensions of the window and the image, and I'm getting one or more values coming up as "0"...... Which means that image doesn't display. The image(s) are NOT zero width or height, and neither is the window..
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
[Code].....
View 5 Replies
View Related
Oct 31, 2011
I have the following few snippets of code:
JS:
Code:
$(function() {
$('.delCatButton').live('click', function(e) {
e.preventDefault();
var cat_name = this.title;
var delCatFormID = $("#delCatFormID").val();
[Code]...
The $_SESSION['delCatFormID'] variable in the process.php page is incorrect, and never equals the posted variable.
View 3 Replies
View Related
Apr 28, 2011
I have a list of links to PDF articles, each link has a corresponding div that contains an introduction to the article. I'm using the onmouseover event in each link to show the corresponding introduction div and hide all the others.
The order and number of the pdf links and the introductory divs are the same. The code below works in IE but not in FireFox - the problem in FF is the index returned from the onmouseover event is double what it should be, so the first PDF link shows the second div, the second PDF link shows the fourth div ect.
javascript:
Code:
css:
HTML Code:
html:
HTML Code:
View 7 Replies
View Related
Nov 5, 2004
var oxml = document.getElementById("xmlfile");
var oDom = oxml.XMLDocument;
var xy=oDom.getElementsByTagName("Name");
I was able to produce the below XML:
<root>
<Name Id="174" userid="A2 " level="1" selected="1"/>
<Name Id="175" userid="A5 " level="1" selected="1"/>
<Name Id="183" userid="A9 " level="1" selected="0"/>
<Name Id="110" userid="B1 " level="1" selected="0"/>
<Name Id="116" userid="B16" level="2" selected="0"/>
<Name Id="109" userid="B25" level="2" selected="0"/>
<Name Id="120" userid="C29" level="1" selected="0"/>
<Name Id="133" userid="D03" level="1" selected="0"/>
<Name Id="132" userid="D3 " level="1" selected="0"/>
</root>
What code do I need to write to traverse above XML code to retrieve those userid value only when the selected=1???? And display the userid "A2" and "A5" with window.confirm in Javascript
View 4 Replies
View Related