if i have this code: <form><input type=text name="id1"></form> then with
javascript i can reference this with this.form.id1, how can i reference
something like this:
I have a table which I would like to be highlighted with the click of a button, but I can't seem to reference it correctly. I can make the <td> clickable and function, but when I try to apply it to the button I can't make it reference the td cell, rather than change the background color of the button.The function is:
I have created an object called list. the object has a method called load and a method called setSelected (it has more, but they arn't impotant here).
The load method prints out table rows like this:
str+="<tr>"+data+"</tr>";
and in the end, inserting str as the body of a table.
what I want to do now, is have an onclick event for each of these table rows, that calls the setSelected method of the current object. so for example, if I'd write this on my page:
mylist = new list(args...); mylist.load(); <div id='associated-div'></div>
that if someone clicks a row in the table that is created in the div, the setSelected method of my list oject will be called.
I'm trying to build a simple "where's the meeting room" page for my work. This consists of a background image of the map, and (right now), a red block absolutely positioned on the map to show where the room is.I'm using an object to keep track of x/y positions for the rooms, i.e.
Code: var rooms = { a123: { x: 100,[code]....
This works, but uses eval() a lot, which doesn't seem like best practice. What's the appropriate way to get the info?Here's the whole page code:
This has really got me stuck. Below is a distillation of my problem:
This is my function:
function Clear(form) { ???.checked = false; } <form name="myform">
[Code]....
How do I execute the function to clear the checkbox the moment it is clicked? How do I reference that specific checkbox, when there are multiple checkboxes with the same "name"?
The rules (the above is a simplified version of my actual problem. There is much more to my script, which means other possible solutions cannot be considered):
1. I am aware of onclick="this.checked=false", but I cannot use it.
2. The ID for the checkbox is dynamically generated, whereas the entire onclick command must be the same for all checkboxes.
3. All checkboxes must have the same name, and the name must have square brackets.
4. "this.form" must be in the onClick, as it is used by the rest of the function.
I'm trying to get a value from a link that a user click on in a pop up window and send it back to the parent window. It's working fine in mozilla and some IE but i'm having problem in IE 5 and some IE 6.
whenever I run the below code I am unable to hide my <DIV>. I have posted a previous post regarding hiding DIVs however as this is slightly different I thought I would create a new topic here to allow for easier searching for other users.
The below code works if the DIV is outside of the form however if I enter it within the form nothing happens.
Is there a way in the Javascript to reference the dom of another page that is online. An example would be if www.cnet.com has an element with an id = money can I reference that page with an object that and get a value from the money element and display it on my page. I know this sounds confusing but really i just want to be able to save a xhtml page that is not on my website. Create a input filestream from that page and use data from the filestream to make data on my own page.
I am loading a set of icons using an array. The reason for this is that the icon set will be different depending on what some PHP code has given to the JavaScript.
My code currently looks like this.
Code:
var things_to_load = new Array(); things_to_load['header_cursors'] = new Array( 'default' , 'pointer' ); things_to_load['header_icons'] = new Array( '../img/triggers/to-roll/undo.png' , '../img/triggers/add.png' ); things_to_load['header_labels'] = new Array( 'undo' , 'add' );
[Code].....
The problem I have is that the click function gives the error "things_to_load.header_clicks[c] is not a function".
This makes sense as presumably the click function is saving the value and not what that value references.
how I can get this code to save the function not the string referencing it?
i have a simple thing that causes me all sorts of headaches. I have many forms on the same page, and identical items in each form. The same object in each form call the same procedure. So, I'm passing in the form value, such as:
onchange="DoMyFunction('formName');" and then in the procedure i do: function DoMyFunction(formname){ document.[formname].object.value='1'; }
Now i have functions like this all over, problem is getting them to work. Once they work, they work fine. But when i add a new one, it can match an old function (except the object being referenced) and it won't work!
Does anyone know the proper way to reference a form in a function?
My functions for mouse_move / up / down all control the movement of a box. So you can click a box and move it anyway. It then snaps to an invisible grid. However there are multiple boxes on the screen so if you move it to a spot where another box already resides, then that box needs to swap places.This is what the mouse_over function tries to do. When I click the first box it stores the position of that box that was clicked. If I release the mouse button whilst hoovering over another box I want the other box to take the stored positions of the first box.However what I think is happening is the mouseover function is applying the new position to the box I'm moving, as I guess this is the first layer the mouse is over.Is there anyway I can reference the layer underneath using onmouseover.
The problem is that while checkBoxName produces the correct variable, the final if statement claims that checkBoxName.checked has no properties. What am I doing wrong?
I am trying to return a JSON string from a server with a list of locations. I want to populate a div with checkboxes and the names of the locations.This is the JSON string I am currently working with:
I have a similarly formed data definition that is hard coded in the javascript for permissions that looks like this:
Code:
var prm = [ {"id":110,"idtext":"110","prmdesc":"Users"}, {"id":130,"idtext":"130","prmdesc":"Forms"},
[code]....
When i run that bit of code it displays Test1A and that is all.I am certain I am missing something basic, but I have not been able to figure out what it is.
I have validation code on my web form used by passing in the name of a field on the form. I have fields on my form named Hospital1, Hospital2, Hospital3, etc. I am trying to write a For loop to validate each one:
with (thisform) { {for (i=1; i<=9; i++) {
[Code]....
What is the proper format of var vHosp= "Hospital"+i; so that it will recognize that field?
I've written several utility pages that use a dynamically created iframe. The iframe typically has a form that is populated by the main page. Then the form is submitted to be processed, and the returning page does something -- call a function on the main page, change a variable on the main page, etc.
All this stuff I created works on IE. Sorry, didn't have other browsers available to test. Now I have access to a machine with FF, and none of these scripts work.
So, short and sweet: What is the proper way to reference a form on an iframe from the parent doc in firefox? Also, call a function from the parent to the iframe, and vice-versa, call a function on the parent doc from the iframe when it loads?
I am using the following system to create my forms : <% using (Html.BeginForm()) { %> Now I want to refer to the form in JQuery, but all the examples I can find refer to the form by it's name. How do I refer to my form if it doesn't have a name?
This references the #Tags element which is an input text box. I would like this function to run on another element also (#Tags2). So if either the #Tags or #Tags2 text boxes are used, the function runs.How can I extend this function rather than duplicating it?
I have a script which works from my main page, but I need to embed it also into an iframed page, and have it affect the main page from there as well. In my main page, I have the following iframes: <iframe id="main"> <iframe id="player"> <control buttons embedded on main page, along with the iframes> The default source of "main" is page A, which is a frameset of pages B and C. In page B, I want to embed the same controls I have on the main page, and have them affect the main page from there.
Here's the controls script from the main page - it works from that page - a resizing onClick of the "player" iframe: <head> <script language="JavaScript"> function resizeIframe(iframeId, iframeHeight, iframeWidth) { if (iframeWidth>0) { document.getElementById(iframeId).style.width=iframeWidth; } if (iframeHeight>0) { document.getElementById(iframeId).style.height=iframeHeight; } } </script> </head> <body> <a id="widenButton" onclick="resizeIframe(player', 420, 720)return false;">Enlarge Player</a> </body> How would I put the widenButton in that back page and still have it affect the front page?
I have managed to write a working script to add together two values and display the total. I need to advance from that stage and now I have a 'quantity' box and a drop-down menu with a few options on it, each relating to a price. I am trying to take the quantity entered by the user and multiply it by the price they select from the drop-down and display it in a third box. So far I have:
two = document.autoSumForm.value from menu.value; document.autoSumForm.total.value = (one * 1) + (two * 1);
How can I rewrite the above to account for the different choices a user can make on a drop-down menu?
I'm trying to build a page that shows random, alternating divs, and have looked at this page as an example. However, the issue at the moment is that although the divs display randomly, they do not disappear in order.The finished "page" is to be referenced by another page that I do not have control over. Here is the section of the file containing JavaScript:
<script type="text/javascript"> var curcontentindex=0 var messages=new Array()
[code]....
I've found very little info on how to reference a previous variable...maybe create an array to store them in, but wasn't sure how to go to the previous value in the array.
I have groups of elements that are scattered around my page but have identical id's so that I can reference them all at once (as a group).These elements are sitting inside of an iFrame, that is sitting inside another iFrame (that is building a nested navigation bar).So what I want to do is have a script sitting in the top document that when a button is pressed it will reference those double-nested identical id's and toggle their display.and this is what I have so far...(while testing, I do not have any identical id's)