Refer To A Selection Box
Mar 17, 2009I have to add a selection box in my assignment, but I don't know how to refer to it in the javascript.
Here is the javascript code I am trying to refer to the selection box with that doesn't work [code]...
I have to add a selection box in my assignment, but I don't know how to refer to it in the javascript.
Here is the javascript code I am trying to refer to the selection box with that doesn't work [code]...
How can I access the text of an url via javascript, ie. get 'foo' (and
send it as parameter in goto(), in example:
<a href="javascript:goto([foo])">foo</a>
Or refer to it globally?
document.links.href.text.value ?
this.href.text ?
How do you refer to an object such as a drop down <select> box before the <select> box appears in the code....
View 1 Replies View RelatedI have a function that sets a value of this.name. If I call a function of that function (is there a better term for that?), I can get the value of that name with this.name. However, if I save that function's function as a variable, and THEN call it, this.name is undefined.
I don't think my vocabulary is clear enough, so here's my example:
function Ninja(name){
this._name = name;
this.getName = function(){
return "ninja "+this._name
}}
sam = new Ninja("sam");
assert( sam.getName() == "ninja sam", "Ninja's name is ninja sam" );
sam2 = new Ninja("sam2");
sam2getName = sam2.getName;
assert( sam2getName() == "ninja sam2", "Ninja 2's name is ninja sam2" ); //fails
log("Ninja 2's name is actually "+sam2getName()) // actually "ninja undefined"
(Note: Use of "ninja" and assertions are because I was playing with the code in John Resig's java runner thingie: [URL]). The reason I want to be able to refer to a function by a variable is because I want to pass the function to something else that requires a function to be passed in, such as an ajax callback or something. Anyway... why is this.name undefined in the second example?
I am trying to concatenate text to refer to a variable:
It give me undefined instead of 17. How should this be done without using eval() ?
I am trying to re-write a script that I found on w3schools. The script should check whether ALT key was pressed or not. My objective is not to use any inline scripts and to refer to the event within a function. My script is not working.
<code>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">[code].......
I have a regular html page called a.html
this page opens a modal dialog window called modal1.html
modal1.html contains a 'Next' button.
when the button is pressed the modal1.html is replaced with modal2.html
modal2.html contains another button.
when its button is pressed, the modal dialog window should close and the location of the original page a.html should change.
I am trying to do something like:
//window.parent.location.href = 'anotherPage.html'
window.opener.location.href = 'anotherPage.html'
window.close();
I cannot use window.opener in modal2.html because its opener is actually modal1.html.
In fact anotherPage.html is opened in a whole new browser page
How can I refer to a.html in this chain?
I attach a mouseover event to a ul. Within the function I can use $(this) or this to refer to the ul.How can I refer to the li element over which the mouse is? And therefore make use of event delegation in jQuery.
View 8 Replies View Relatedfunction JGallery(){
this.name="defaultGallery";
this.images=[{//some JSON here}]
this.render=function(){
[Code].....
I've tried to debug it in firebug, but I guess there is a problem with the scope of the 'this'. The 'this' in
//i want append div with id of the name property of jgallery class
$("<div></div>").appendTo("#container").attr("id",this.name);
seems to refer to the iterator in the $.each().
I've tried to do this.this.name but it still doesn't work. Is there any way to allow me access the property of the Jgallery class?
I am creating an application that uses as much Object Oriented code as I could (mostly to learn it).
I have an object called 'photo' that contains two Image() objects 'fullImage' and 'thumbnail'. All is fine and dandy, I can read the thumbnail and the full image, and their associated properties just fine.
But what I can't seem to do is make the thumbnail's onclick event refer to one of the object's methods.
Here is a greatly simplified version of the object's code.
Code:
So, the thumbnails div gets populated with the thumbnails fine. But for the life of me, I cannot figure out how to make the onclick call the photo object's "editPhoto" method.
Will the way that I am creating the objects using the same name for each one, result in only the last one created being accessible. If so, do I need to create an array of objects so I can uniquely identify each one?
I'm passing the id of a div as a parameter. I'm not sure how to refer to it with Jquery. The following does not work:
Code:
function updatemail(param1, param2) {
$("#param2").animate({ opacity: "show" }, 300);
}
I also tried $(param2) but it did not work.
I have a dropdown which is being dynamically generated within the cfloop query.
<select name="ResourceType#ctr#" onchange="GenRWType(this.name,0)">
<option value="">None</option>
<cfloop query="getResourceType">
<option value="#getResourceType.Resourcetypeid#">#getResourceType.Resourcetype#</option>
</cfloop>
</select>
I am calling the JS function GenRWType which is carrying the name of the dropdown.....the issue is how do I get the value of the selected option from dropdown ? This is the code I have and it does not recognize "rname"
[Code]...
I'm using getJSON to retrieve information from a header record and the corresponding detail records and display the detail records in a table. The PHP script that is called returns a JSON string (via json_encode) that looks like this:
{
"srn":"1",
"invNo":"1",
"custNo":"39750",
"purchOrd":"PO12345",
"shipVia":"our truck",
"jobNo":"E001-11",
"invDate":"8/3/2011",
"taxCode":"1000000",
"shpName":"testName", .....
Here is the html table:
<table><thead><tr>
<th colspan="2" >Item Description</th>
<th>Quantity</th>
<th>U/M</th>
<th>Item Price</th>
<th>Item Amount</th>
</tr></thead><tbody>
<tr class="p_row_1"> .....
And here is the $.getJSON:
$.getJSON("GET_INV_INFO.php",{srn:'<?php echo $srn; ?>'},function(s){
// Get Header Info
$('#ip_invNo').html(s.jobNo);
$('#ip_invDate').html(s.invDate);
$('#ip_custNo').html(s.custNo);
$('#ip_purchOrd').html(s.purchOrd);
$('#ip_custName').html(s.custName); .....
My problem comes in the getJSON section where I'm trying to populate the table with a record. I don't know how to refer to the different fields in array 's'. I've tried the following and many variations, but to no avail:
$('.p_row_'+i+':nth-child(1)').html(s.row.i.itemNo);
$('.p_row_'+i+':nth-child(1)').html(s.row[i].itemNo);
How do I refer to a nested field in a multidimensional array like this?
I want to put a value in a cookie. The following code does not work.
It does not store the box1.value in the cookie. How can I fix it?
<input type="text" name="box1" onblur=document.cookie="user=" + box1.value>
How can i create a date drop menu that automatically have today's date
selected?
function spawn(ev){
var oSelect = ''
var oFlag = false;
if (ns4 || ns6)
oSelect = document.getSelection();
else if (ie4 || ie5){
if (!ev)
ev = window.event;
oFlag = true;
oSelect = document.selection;
}
alert(oSelect.type);
}
if (oSelect == '')
return;
else{
//stuff
}
In Netscape 4.8 if text is not selected nothing happens which is what I want. Please
disregard the fact that oSelect.type is not Netscape compatible you are really
seeing only a partial of what I am doing.
The issue here comes from this page: Code:
I am trying to achieve in Netscape what I can achieve in IE by
document.selection.empty(). This will remove the highlighting created by
Ctrl A or by dragging over text on a page. I can access the selection object
in NS using window.getSelection() but I have not found any way to clear it
so as to remove the highlighting. I have tried the collapse() method but
that does not do it.
I have 3 checkboxes but the user should select just one. How to block multiple checkbox selection ?
View 1 Replies View RelatedI wrote the following code. So when the user presses the button it should select the second item in the list box. Would someone mind helping me fix this code so it works? Code:
View 1 Replies View RelatedI have this in query:
That works fine for input:text boxes but doesnt work for dropdown menus.
How to i have the state dropdown to be the same for the other.
if i have a picture 300x300 px on-line!!!
is there a way to select a piece of that picture where i want like 120x200 and that that piece is showed into new window!!
something like photoshop when i select with the mask!!!
suggestions?
how i can create the list of menu that when we want to select certain item instead of we must select manually....mayb u all dont understand...ok like this, i want to select item 'cow' in list of cat, dog, cow, deer n etc...so when i press 'c' then the item cat n cow will appear, but i dont want be like that....but i want when i press 'c' the menu list appear as usual then when i press for the 2cd time, i press 'a' only cat will appear in the option list.
View 1 Replies View RelatedI want to know is it possible to block user from selecting any text displayed on a webpage? What I want is to block user from selecting anything by mouse drag.
View 5 Replies View RelatedI have 3 drop downs for day/month/year ,this basically is for when some
text entered into a textarea is entered expires
However there will be some text that will never expire,so I would like to
place a radio or even a check box that says "never expires", however
when this is ticked I would like the 3 selects for day/month/year to be greyed out, so that they cannot be selected. Is that possible.?
I am trying to set the value of one drop down select box to the value of another drop down select box. I have the following in a function.
document.formname.boxto.options[document.formname.boxto.selectedindex].v
alue =
document.formname.boxfrom.options[document.formname.boxfrom.selectedinde
x].value;
but I need to change the above line to allow the 4 references to "boxto" and "boxfrom" to be dynamic so their values can be passed to the function each time. Any ideas?
I am looking for a working replacement
of the following function for Mozilla (this was written for IE):
// encloses the selected area into starting and closing tag
// if no closing tag is given the starting tag will replace the selection
function encloseSelection(startingTag, closingTag)
{
editRange = editArea.document.selection.createRange();
if (closingTag) {
editRange.pasteHTML(startingTag+editRange.htmlText +closingTag);
return;
}
//editRange.collapse(false); // move insertion point to end of text range (append tag)
editRange.pasteHTML(startingTag); // replace selection with startingTag
}
Longer version:
I am working on making an older "WYSIWYMG"-editor (written for IE)
Mozilla-compatible. Everything works fine so far, but I am not able
to figure out a solution to the above problem.
I'd like to enclose a selected text in one of the famous
"designMode=on" iframes with HTML-strings. I've tried numerous
ways - by now without luck.