Back To Javascript Gurus, Problem Is Check Box Arrays
Apr 13, 2007
I'm having an array dynamically fetched from the database using php, in result, I'm getting a check box, with their corresponding value.
I wanted to make a javascript function so that if I uncheck a checkbox, corresponding value disappears.
Before going to the looping, I was trying to do a simple check - like this -
function checkOtherValues() {
if (document.myform.checkmember[0].checked==false) {
document.myform.checkvalue[0].value="";
}
}
I thought this should work, but I'm getting the following error -
document.myform.checkmember.0 is null or not an object For the form, it's set in this way -
I cannot figure out how to return the array back to the main method! import java.util.*; //lab 3 public class Prices{ public static void main(String[] args){ double []array; array = new double[10]; double fullPrice;
System.out.println("Please enter 10 prices: "); for (int i = 0; i < 10; i++) tenValues[i] = input.nextDouble(); return tenValues; }} I thought you return an array by simply return (array name);
<script language="Javascript"> <!-- function checkFields(){ var errormsg = ""; if (document.this_form.this_select.value == "") { var errormsg = errormsg + "Please Select an Value.
This may be more of a Java question, but I feel that JavaScript experts may be more qualified to help me find a solution.
In short: is it possible to call a Java method from JavaScript, passing as an argument a JavaScript array (in my case, an array of doubles)?
Supposing I have array x containing only doubles, I have tried: document.MyApplet.myMethod(x);
But the method only ever seems to receive "null" as an argument. Conversely, if I try this with a String, or a single character, or almost anything else, there isn't a problem. Any ideas?
I know very little javascript and need to use it to pt a banner across a page, where it is pulling from values a customer puts in the backend.Here is the javascript: Code:
I'm attempting to use the javascript 'history.go(-1);' to make a page automatically return to the last page a user visited. At the moment, I can get this to work ONLY if I insert a link into the page.
What I want to happen is, the page autmatically sends the user back to the previous page after a set time. I have this for my JS:
function backtomusic() { window.location = history.go(-1); }
And in the body section of my page I have:
<body onLoad="setTimeout('backtomusic()', 3000)">
When it runs I get an error saying 'undefined' in the browser address bar
I have a page where users can filter a list of links using javascript clicks. The user then clicks a link in that list, views the page and then clicks back on the browser to view the rest of the list but the javascript options they filtered in the list are gone resulting in them having to do it all over again. Is there a solution to this?
Would it work if I store their selections in a cookie each time they click a javascript button and then when they visit a link and click back (to what is presumably now a cached page) will I be able to have javascript that will read the cookie and reset their options again or is the cookie not loaded on a cached page?
Are there any common solutions to this kind of thing?
Okay, so I've just installed a javascript that redirects to any random page from a specified list. The problem with it is, it's in an iframe and works as sort of an advertising area. So on the mainpage where the iframe has been placed, whenever someone uses the back button, it just keep going back in the iframe and choosing random pages. The back button doesn't work on the mainpage and instead is used in the actual iframe.
I'm not sure if this is a problem with the iframe or the script, and I don't think I have the mental capacity to figure it out so I'd really value some help! Oh, and apparently the problem doesn't occur when using Firefox. Code:
I've browsed through past usenet archives, but can't seem to come across quite the javascript I'm looking for. I'm looking for a simple javascript that will display the date as such:
May 17
So basically, just displaying the current month and the current date. But I would also like the ability to backdate by one day, two days, etc.. So the next date might look as such:
May 15
Which would be two days earlier than today's date, but in keeping with the same format.
The following script is supposed to have high categories as radio buttons and mid categories as check boxes. Clicking the radio button is supposed to select all checkboxes under it and submit the form.
RADIO (ID = 0001-1 VALUE="") CHECK (ID=0001-0011) CHECK (ID=0001-0012) RADIO (ID = 0001-2 VALUE="") CHECK (ID=0001-0021) CHECK (ID=0001-0022)
The code appears to be checking and unchecking the correct checkboxes. But when the submit occurs, the buttons that were unchecked become checked again.
function handleHighCatSelect(obj) { var highCatName = obj.name; var highCatNameInMidCat = highCatName.substring(0,5) + "00" + highCatName.substring(5,6); alert(highCatName); var length = document.frm.elements.length; for (var i=0;i<length;i++) { var formObj = document.basicSearchMFSFrm.elements[i]; var currName = formObj.name; var currValue = formObj.value;
Basically, I have a page that I load with 10 input fields. If users have JS enabled I want to hide 5 of these fields so as to reduce clutter. If the user needs these extra fields an "Add" button can be used to display the hidden fields one by one.
Once the fields a filled in the user submits them for validation and if there are any error They can "Go back" to make some changes. The whole process works great in FF & Opera but IE lets me down because if you use the Browser "Back" button the Javavscript gets executed even though it should be loaded out of cache.
In one of my pages, I use javascript (AJAX) to populate one mulitple select field based on user's click event on another control. I noticed that when I navigate back to this page by clicking browser's "Back" button, the changes made to the multiple select is not preserved. (It shows the initial value). While all the other user selections are preserved.
I'm having some problem with checking with the follwoing code:
if (appForm.q15a[i].checked==true && appForm.q15cert.value==""){ alert ("You must enter value!!!!") valid = false; }
What I'm trying to do is have the user enter some data based upon if the radio button is true and the text field is empty. What could be wrong with the following code above.
does anyone have a handy check all script? I have a series of check boxes in a form and would like to add the option of clicking a button to select all.
Does anyone know of a way I can check asp validator controls from the client side? I need to be able to opt out of a postback if any validators are false. I am using a ComponentArt tabstrip and it proceeds with posting back even if "IsValid" is false.
I have to access a website which does a stupid browser check and only accepts Netscape 4.7. The problem is that I have to access the website with Mozilla or Internet Explorer. Code:
I want to create a button(s) to check all/uncheck all the check_boxes if clicked by the user. I was thinking I had to use javascript to do this, but the erb is appending the value to the name in the HTML output. What this does is prevent my javascript from recognizing these check_boxes as a collection named "patient".
I know this isn't a pure javascript question, but I am at a loss. I am new to both languages, which doesn't help either.