Data-Type Reference Material?
May 20, 2011
oes anybody know of a good reference document/source for data types that you can pass to a function, please? What I want to establish are the variety of elements that can pass data to a function in the following way:If you set a value to a table cell (<td>) then you retrieve it in the function thus:
function(row) by calling function(this).
I know that divs and spans can do this too, but how about images in a loop with unique names etc?
View 6 Replies
ADVERTISEMENT
Oct 7, 2004
I am doing in a loop
element = xGetElementById(obj.ID+i);
position = element;
I need this several times in my script and I am sure it createst quite a lot of overhead. And I would like to pass xGetElementById(obj.ID+i) into an element array. like:
element = new Array();
element[i]=xGetElementById(obj.ID+i);
So I can call back element[i] etc in my script by saving some overhead BUT (there is always a 'but' in my posts ) then:
position = element[i]
does not give anything.
Any clue? Is it possible?
View 4 Replies
View Related
Nov 5, 2002
Using DOM in IE 5.5 I'm dynamically building table rows containing HTML input elements (checkboxes, text boxes, etc.), one element per TD. Note that these rows are clones - all the element id's for a given element are the same across rows.
Now, For certain things I need to reference two or more elements in the same row. For example, if I check this checkbox I want to enable that text box.
When I click a checkbox I know what it's parent is (the specific TD) and the grandparent (the specific row).
My current effort has me grabbing the table row where the click event happend then, using a pair of nested loops searching for the specific field I want. It works, but it looks like overkill to me. There's gotta be a more elegant way. I don't want to search through all the childNodes when I know which field I want, and it has an id unique to that row.
Can I reference things by their id? In other words I want to say something like this:
thisRow = variable reference to the TR object containing the clicked-on element.
thisRow.theTDid.theCheckBox'sId.checked = false;
or at worst:
thisRow.getElementById("theTDid").getElementById("theCheckBoxId").checked = false;
These don't work but what would? I want to avoid blindly iterating through all the TR's childNodes inside a loop going through all the TD's childNotes, looking for a specific data entry element.
View 6 Replies
View Related
Sep 13, 2006
A while ago I wrote a "Vector data type" script
using DOM interface to select.options.
That was a (beautiful) mind game :-) rather than
a practical thing to use.
Here is another attempt open for criticism, this
time dead serious. I really need an effective
Vector emulator for a project (as much effective
as something not implemeted in language but
emulated by means of the language itself is: a
productivity impact is imminent, the question
is to minimize it).
<html>
<head>
<title>Vector constructor</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script>
function Vector(arr) {
this.$_$ = arr || new Array();
this.length = this.$_$.length;
this.add = Vector.$add;
this.remove = Vector.$remove;
this.toString = Vector.$toString;
}
Vector.$add = function(m,i) {
if (('number'!=typeof(i))||(i<0)||(i>=this.$_$.length)) {
this.$_$.push(m);
}
else {
var tmp = [m];
tmp.push(this.$_$[i]);
this.$_$.splice(i,1,tmp);
}
this.length = this.$_$.length;
}
Vector.$remove = function(i) {
var ret = this.$_$.splice(i,1)[0];
this.length = this.$_$.length;
return ret;
}
Vector.$toString = function() {
return this.$_$.toString();
}
// Create new vector and use it as a wrapper
// over Array argument:
var v = new Vector([1,2,3]);
// add(newElement, atPosition) method
// if no atPosition provided, newElement will
// be added to the top
v.add(4); // add 4 to the top
// Add 3.5 atPosition 3
// The element currently located at v[3] and all elements atop
// of it will be moved one position up
v.add(3.5, 3);
// remove(atPosition) method
// Elements currently located atop of it will be moved
// one position down
v.remove(1);
// toString method is overloaded so in string
// context it gives comma-separated vector values
alert(v); //1, 3, 3.5, 4
</script>
</head>
<body>
</body>
</html>
View 28 Replies
View Related
Nov 27, 2011
I have writing a plugin, and have a question.about data in {} like css({}), ajax({}).what is the data type when using {}? what will they become that using in {} when they are send? are they become an array or an object?
View 1 Replies
View Related
Feb 25, 2009
so I want to set up some 'freebies' on my website... random verses and 'updating' content that I would like to change every so often, without the 'user' of the content (people reposting on their website) having to change the code every time (and without giving away the COMPLETE code)... am I making sense?I want to offer a different code in the 'textbox', where others grab the code than the complete 'building' code...:confused: I am so lost! :confused:I'm brand new at 'codes'
View 2 Replies
View Related
Sep 19, 2010
How can I draw a cookie where number of chocolate chips represents the number of seconds and the number of bites represents the number of minutes.
I want to show the passage of time on a clock that looks like items are being added to the display according to the number of seconds and minutes. Maybe using a mouse input aswell
View 1 Replies
View Related
Feb 28, 2011
I need to learn ajax can i have some material to learn..
or give me useful link to download some material
View 2 Replies
View Related
Jun 12, 2011
Im trying to get the hang of it. I am trying a simple data entry page, where you can enter the name and type of an animal (eg Freddy the ferret) and it will be added to an HTML table.
The bottom of my table looks like this...
...and I have the following in the <head> tag of the page...
The way I thought this should work is that the first bit of the line would create a new DOM element, consisting of a <tr> with three <td>s in it, the first and second of which would contain the values the user entered. This new DOM element would then be inserted into the table right before the last row.
The problem is that the values from the two <input> tags are ignored, and a row with three empty cells is inserted...
I tried adding the following to the script...
And this showed fine, implying that I am getting the values correctly.
I even tried hard-coding the whole line, but that still added empty cells. Oddly enough (to me anyway), the space in the third cell was recognised, but the hard-coded text in the first two cells wasn't.
View 5 Replies
View Related
Nov 15, 2010
Im having a bit of an issue with a website im building for a band.The band want a site that is 2500 width so that when the page loads you can either scroll right or left to view the out of screen material...i cant find a way of the page loading centered...it is always loading to the far left and all i can do is scroll right...i have uploaded the site to http:[url].... for you to have a look at so you see what i mean.I origionally posted this thread in the CSS forum but was instructed this would be a Javascript issue.
View 1 Replies
View Related
Feb 22, 2010
I need to add an event for all elements that are not text entry.I have tried this
$(':not(input:text, input:textarea)')
$(':not(:text, :textarea)')
I tried to get it to work for just not type=text
$(':not(:text)')
$(':not(input:text)')
I can't seem to figure it out.
View 5 Replies
View Related
Jul 15, 2011
I'm trying to use a plugin for paging from jquery, the thing is that the demo is not very clear, at least for me that I'm not very familiar with jquery and httphandlers. Here is the javascript code.
$(function () {
var a = 10;
var b = 10;[code].....
Then in my handler I'm trying to do this, this is beacause I'm following a tutorial to use a Jquery Plugin for paging, the web page for this plugin is http://jpaging.fahon.org/usage.In the handler it puts this code in the http context function
the "context" is the HttpContext variable.
context.Request.Form["type"]
I thought it was getting the variable "type" from the data in the ajax in the javascript but it does not get me anything, it always gets null.What am I doing wrong?
View 4 Replies
View Related
May 23, 2011
I have to change text input type to password input type and i am using jquery script. This script work for FF, Chrome and Safari browser but not worked on ie7, ie8.
Script is as:-
How can i update my script, so that it works cross the browser.
View 1 Replies
View Related
Mar 15, 2006
This code does not working in Mozilla. Works fine in IE.
--------------
<input type=text value=100 name=textbox>
<script>
alert(textbox);
</script>
--------------
This perhaps, because of Microsoft policy to globalize all tag names. Is there any method for cross-browser fix without using getelementbyid? Is there any method to pass values from outside of <script>, inside? (something like "global" in php functions) Javascript must be kept inside <script> tag.
View 24 Replies
View Related
Apr 7, 2005
i'm wondering how i can get a reference to the next td in a row? Do i need to assign all td's an id or something? i could do that failry easily because the table gets generated dynamically via a php function.. i just hink this would be nice that way when i go to delete something (with those infamous checkboxes) i would like the javascript prompt to display what it is that will be deleted..
View 7 Replies
View Related
Jul 23, 2005
I need to do a function in javascript to check or
uncheck all checkboxes with the same id. I want this function to work
in every form and every page of my site, as I will use the same id
("sel") for all checkboxes in the site. So I need to refer to these by
id. Code:
View 4 Replies
View Related
Aug 31, 2006
I have a form that appears several times on a page, and would rather not assign IDs. Is there a way to have my validation function focus() a text input without IDs?
View 7 Replies
View Related
Jul 25, 2009
i have this code:if (! $_POST["Name"] || ! $_POST["LName"] || ! $_POST["email"] || ! $_POST["phone"])
{
$Alert_Message = "Invalid Form";
}i got a js script from another forum here on this site that looks like this, and does work well:print <<<JSOUT
<script type="text/javascript">
confirm("Form is INVALID");
[Code]...
exit;i have 4 different messages that i want to choose from to be displayed in the js script, and I want to store the message that i want to use in a PHP variable along the way. the variable is: $Alert_Message . i am trying to do this with my confirm() function in js:confirm($Alert_Message);the code is not registering, so something is obviously wrong. can i reference PHP this way in a js script? if not, how would i go about doing this another way? can i change a js variable along the way in my PHP code instead, and then reference THAT variable when i get to my js script?
View 1 Replies
View Related
Jul 23, 2005
We're in the process of re-writing the Intranet at work, and my javascript
knowledge could be written on the back of a post card. ;-)
Can any of you point me in the direction of some code that would enable a
form to open a specific pdf file? Details are below.
--------------------
All of our purchase orders are saved back to pdf files. Each pdf has the
prefix "PO_" followed by the po reference, then the file extension ".pdf".
For example, our file would be called "PO_12345M.pdf".
Each set of files is archived into years (folders are called 2003, 2004,
2005 etc.) so it will probably need a drop down box to select year, unless
it can search through all the folders.
The visitor should only need to enter the PO reference, and the code puts
the "PO_" and the ".pdf" on the end of it, and hey presto Acrobat opens with
the PO, or you get an error dialog if the file cannot be found.
--------------------
View 2 Replies
View Related
Jan 4, 2006
Since a few years I make use of an online service which provides me
statistics about visits to my web site. The only thing I have to do is
to include a few lines of Javascript in the most important page. The
company providing this service - Nedstat - has been acquired by a more
commercial party called Webstats4U and they have now decided to cause a
popup window to appear with a commercial message, every new day you
start up the page. Given the nature of the web page, this is
unacceptable. Does anybody know how to check whether a window has been
opened from a page and - if so - how to get a reference to that popup
window so that I can close it?
View 1 Replies
View Related
Jul 8, 2006
Example: I have an aspx page with several fields and a grid. When I
click on the grid i use js to poulate the form layout. I have maybe 15 different forms each with a different table. I have a lot of common js code that I put in a
separate file.
I have a function in that file that needs t obe specific
to each webform because the data is different. so in the separate js
file from a common function I want to call
PopulateSpecificForm(DataRow) and put that method in each webform.
It doesnt work? any ideas?
View 1 Replies
View Related
Oct 14, 2006
I've been doing this to get a reference to the body node of a document,
but I'm sure there must be something simpler than this:
var arrayOfBodyElements = document.getElementsByTagName("body");
var referenceToBodyNode = arrayOfBodyElements[0];
I tried:
var referenceToBodyNode = document.body;
and:
var referenceToBodyNode = window.body;
both of which got me "body undefined".
So what is the right way to get a reference to the body?
View 1 Replies
View Related
Jul 20, 2005
I'm working on an asp.net site and am trying to implement a popup help
window. I want the window to close when the user advances to the next page
in our application. The thing is, I'm doing this on a component basis and I
don't have access to the body tag from within my help component, so I can't
add the onunload tag. Is there some other way of achieving what I want? Can
I add an eventhandler to the body tag through javascript?
View 2 Replies
View Related
Jul 20, 2005
I am writing a validation function: what I want to do when an error is detected is to open a second window containing error messages. The form being validated is rather long, and there are several points in the code where I write the messages. So, I would like to have a separate function just to open the second window with an appropriate title (something like "the following errors were detected in your form"). something labout like this:
View 2 Replies
View Related
Sep 15, 2010
What I'm trying to do is when the mouse hover on the level1 class, I want level2 class change it's background color. But I do not know how to reference a subclass.
<div class="level1">
<span class="level2">One</span>
</div>
[code]....
View 4 Replies
View Related
May 31, 2010
Where can I find API reference ? for example, on the web, I found Dates documentation[url]...
then I try to find similar docs in official JQuery website, failed.
View 6 Replies
View Related