Finding X, Y Of Div?
Feb 10, 2010
I have a div, which can be anywhere in the document. I want it like, when I click anywhere on the div, it tells me the X, Y of the mouse in the div. Like X mouse - X div (left) and Y mouse - Y div (bottom). So that I know the width and height of the mouse according to the div. Is it possible or cross browser?
View 9 Replies
ADVERTISEMENT
Jul 23, 2005
How can I findouf the URL that the webpage came from?
Like document.address or something?
View 2 Replies
View Related
Oct 2, 2006
I have a div which wraps a table. Initially, the div's display attribute is "none", basically I need to find the height of the table in the div, and use that information to render the div to the user. The div is rendered only on the users request.
View 1 Replies
View Related
Feb 3, 2006
This is just some functionality missing in the Array object that I'd find very useful...
Array.prototype.inArray=function(oObject){
for(var i in this){
if(this[i]===oObject){
return true;
}
}
return false;
}
to use:
var oObj=new Object();
var aArray=[1,oObj,"string"];
aArray.inArray(1); // returns true
aArray.inArray(oObj); // returns true
aArray.inArray("string"); // returns true
aArray.inArray(2); // returns false
View 2 Replies
View Related
Apr 4, 2006
I want to be able to find the height of a div in pixels without defining it in JavaScript. The Div needs to be able to have whatever content in it is required, and it will change without a refresh. I have no idea what could possibly do this, I was hoping somebody with more experience with JavaScript could help me :D
It also really needs to be at least Internet Explorer, Firefox and Opera proof.
View 3 Replies
View Related
Jul 22, 2010
Title doesn't really give this thread justice ... I have a content div with an image and text included into it. This same div class is being used multiple times. What I want is to be able to click the image, and have the <p> in that div toggle to show or hide. Here is the XHTML code for the front-end:
<div class="content">
<img src="image_big.gif" alt="image" class="toggle_font" />
<p> Caption for the next image. </p>
[code]....
View 7 Replies
View Related
Sep 28, 2005
How can I get the position of an element such as a div?
View 2 Replies
View Related
Jul 23, 2005
I'm trying to make some changes to the Javascript portion of our
corporate intranet site and I'm trying to find if theres a way to find
the User's login id from a Javascript function?
If not, is there a way to run a 'echo %USERNAME%' from DOS command
window and obtain the output. I realize there's an inherent security
risk if Javascript were to allow that.
Am I barking on a completely wrong tree, is NTLM authentication what I
should be looking at?
Basically, I need to get the user id without the user having to supply
it on the page manually. Can this be automated?
View 2 Replies
View Related
Jul 23, 2005
I would like to check if a string is a valid zip code via Javascript.
Length and existents are already checked.
How can I find out if the string contains characters other than numbers?
Example: 834F7
schould be false since it countains an F character
View 4 Replies
View Related
Sep 11, 2005
How would I access the source of a webpage? I would like to get the source,
then use a regexp to find text on a webpage. For example, retrieving a
counter, or some other text that dynamically changes. I'm implementing this
for firefox.
right now, i have a web page opening that contains that info, but i would
rather have a pop up alert() that shows that info.
View 2 Replies
View Related
Jun 4, 2006
Say I have some CSS, which is several hundred lines long, with the
contents in this format:
..foo {
blah
color:#000;
blah
}
..bar {
blah
color:#FFF;
}
where the selectors and their opening braces, their closing braces, and
declarations are each on their own lines (always), how can I replace a
specific declaration (line) given a unique selector and a declaration
property. For example, if I wanted the 'color' declaration property line
in the 'bar' class changed.
At the moment I'm iterating through the CSS one line at a time looking
for the selector and then looking for the declaration property (before I
hit the closing brace).
View 1 Replies
View Related
Aug 6, 2006
Is there a way to get an array with every value of a list?
document.myform.myselect.options doesn't seem to work.
View 1 Replies
View Related
Jan 20, 2011
I have a link styled with css that I'd like to change with a mouse event. It's going to be on a touch screen so I'm assuming I should adopta mouseUp/mouseDown model?
[Code]..
View 6 Replies
View Related
Jan 20, 2010
i am creating a simple dynamic menu for my study with the following structure:
[Code]...
now i need to find the correct selector for the mouseout event, because now the submenu disappears if i am getting of the current element (this) of the mainmenu, but i only want it to disappear if it is not anymore over the submenu, or if the mouse goes over another element of the main menu.
View 2 Replies
View Related
Sep 30, 2009
I'm looking to grab the width of an <li>, including padding and margins that doesn't have a set width, and has one of 'auto' or 0.
View 5 Replies
View Related
Oct 3, 2009
I seem to be rather bad at formulating my questions, so let me try another way; given the following:
DOM:
DOCUMENT
HTML[code]....
How do I get/set that textarea value?
View 2 Replies
View Related
Mar 31, 2009
I'm looking for a sleep function in JS. An event is triggered on mouse-out. But I want the action to kick off x seconds AFTER the event. So, perhaps I'm looking for a "sleep" function in the event function?
View 2 Replies
View Related
Aug 10, 2009
I have what I thought was a fairly simple problem that I would be able to solve on my own, but the code I have found is just too complicated for me to understandI think what i have is similar to the knapsack problem, but I have a really simple version of/~moshe/recor/knapsack/knapsack.html#defSay I have a relatively small array of numbers:2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 7, 8, 9, 10. I just need to verify true or false if a combination of these numbers will add up to 21. The numbers will obviously be changing, ( and in array size), i guess i could just use if statements but it would be stupid and go on for ages.Could anyone point me in the direction of some simple code, or easy to understand way to go about this problem?
View 20 Replies
View Related
Feb 2, 2010
Alright so for my website (I've totally revamped it and what not) I want to make a code highlighter for source code / tutorials I've posted. At the moment I'm just using some css:
div.code
{
font:1em "Courier New";
margin: 10px auto 10px auto;
background-color: #FFFFFF;
border: thick solid #555555;
color: #000000;
white-space: pre;
font-size: 12;
}
So the code stays neat and in a box. But what I want to do now is somehow make a small javascript function that scans the text inside the html file etc :
[Code]...
and can format it so float and int is blue, "hello world" is red etc. As from the javascript I've done myself I can't see it being to hard. I'm just unsure how to scan for text inside like I have above.
View 3 Replies
View Related
Sep 8, 2010
I've been trying the find the (x,y) co-ordinates of an element. I've been using;
document.getElementById(element).style.top
document.getElementById(element).style.left
However this doesn't always work in my script. Now, I've googled how to find the position of an element. And come accross many scripts which supposedly all find the position of any object. Some are very long scripts and some are very short all using a variety of methods. Incidently none of which work, they all return (0,0).
View 3 Replies
View Related
May 17, 2011
I'm having a hard time trying to get this script to work. I am trying to write a script that finds the highest of 5 numbers and places the highest number in the last textbox.Can anybody tell me what I am doing wrong?
<HTML>
<HEAD>
<TITLE>COMSC-100-1241 - Assignment #10 - Using "Greater Than" And "Less Than" Logic</TITLE>
[code]....
View 3 Replies
View Related
Nov 5, 2011
need to find the highest average from all of the averages entered in this code, but i have to use an if statement only, no arrays.
// ** Work out average ** //
average= readingSum/totalReadings
// ** Put average into a category and display everything ** //
[code]....
View 15 Replies
View Related
Nov 18, 2006
trying to read text from text child, basicaly seeking for equvivalent for this:
var groupArray = secondElement.getElementsByTagName("DIV");
// so looking for text nodes
var groupArray = secondElement.getElementsByTagName("??????");
hmm tryed this, seems DOM doesn't see the text node that itself created
// 1.CREATING & filling
imgElement = document.createElement("IMG");
imgElement.src = arrElementsImages[i];
imgElement.setAttribute("style","float:left");
imgElement.style.styleFloat = "left";
firstElement.appendChild(imgElement);
firstElement.appendChild(document.createTextNode("u00a0" + "a"));
//2.TRANSFERING ALL CHILDS TO secondElement
// case1 --> ONLY IMAGE APPEARS !!??
for (i = 0; i < firstElement.childNodes.length; i++)
{
secondElement.appendChild(firstElement.childNodes[i]);
}
//case2 --> TEXT AND IMAGE APEARS
secondElement.innerHTML = firstElement.innerHTML;
View 3 Replies
View Related
Aug 31, 2005
I am trying to dynamically find the position of an anchor on the page. I have a page where you can get to the anchor in the normal way (http://www.mypage.com/index.html#anchorname), but there is a script on that page that adds fields dynamically. This causes IE to lose the place where it was supposed to scroll to (via the anchor).
After the fields are added, I want to rescroll to the location of the anchor. Here is the code that I have running on the page. Code:
View 2 Replies
View Related
Sep 30, 2005
I got a script from brothercake which gets the absolute position for an element. Its pretty neat - recursively adding up offsets. I got it from the image transition scripts on his site.
However, this script uses offsetTop, offsetLeft and offsetParent, which dont seem to be supported by FireFox (or maybe I'm doing something wrong).
Here's brothercake's script:
getRealPosition = function()
{
this.pos = (arguments[1] == 'x') ? arguments[0].offsetLeft : arguments[0].offsetTop;
this.tmp = arguments[0].offsetParent;
while(this.tmp != null)
{
this.pos += (arguments[1] == 'x') ? this.tmp.offsetLeft : this.tmp.offsetTop;
this.tmp = this.tmp.offsetParent;
}
return this.pos;
}
It seems to work for Opera and IE - but not FF. Cant say for other browsers. I've come to rely on it for a part of my 'cross-browser' page. Any thoughts on what I can do?
What I can't figure out is why it seems to work fine on brothercake's site - even in FireFox. I'm supposing that the positioning script must be working because the images appear in the right spot.
View 4 Replies
View Related
Aug 3, 2010
I have multiple select boxes that have various options such as 'bangles', 'rings', 'earings' etc and I have a div that doesn't display until an option has been selected from one of the select boxes. If the option 'rings' is selected I don't want to display the div '#size'.
Jquery function:
The trouble I'm having is that I can't figure out how to use $(this) with option:selected. if I simply put the id of one of the select boxes then it works, but only for that one select box. I want it to be dynamic.
View 1 Replies
View Related