Javascript-Simple,Please help!

Am having the script as follows and it gives error only when I use the condition:
function chgpp(which)
               var byId=document.getElementById;
               if (document.myform.("gp"+which).checked=true)
                    document.getElementById("chgbg"+which).style.backgroundColor='6699cc';
If I don't use the if condition,it is working fine.Can anybody help pl!Thanks.

document.myform.("gp"+which).checked=true)You can't use '("gp"+which)' in this statement. You have to mention exact name of the form field. Or try using,
document.getElementById("gp"+which).checked=true){
Sudha

Similar Messages

  • How to set a param in href or using Javascript. (PLEASE HELP)!

    Hi,
    I have a servlet, that requieres 4 parameters: the jsp page, the bean, and one value from my list box.
    I having an issue in order to set the value from my listbox to my href. If I put the value in the variable it works very well, but if i try to read the value from my list box, always givme a null.
    Here is the Href sentence:
    <% String input = request.getParameter("dominiocustomer");%>
    <TD Height="20" width="100"><a href="/servlet/PInfranetServlet?page=change_login_form&Component=com.portal.web.comp.PServicesBeanImpl&loadBean=yes&dominiocustomer=<%=input%>">Cambiar
    Login</a></TD>
    Where the "dominiocustomer" is the name of my listbox.
    One important thing is that the list box object is under this piece of code, and I don't know it this is the reason, that I having a null value.
    I appreciate any help!

    If your list box (I assume we're talking about the <SELECT> element) is on the same page as your posted code it won't work unless you've made a preceding POST or GET request from the same page.
    The request.getParameter("parameterName") will retrieve that parameter from the preceding request and not from the same page (unless the above mentioned circumstances).
    If you want to use a value from within the same page I recommend Javascript:
    <TD Height="20" width="100">
    Cambiar
    Login</TD>
    where the function would look something like this:
    <script>
    function goLink(param1){
    var dc = document.yourFormName.theSelectListName.value;
    var linkURL = param1 + dc;
    window.location.href=linkURL;
    </script>
    /Rickard E

  • Never used JavaScript before,  please help!

    Hello, I've created a form and need help entering calculations in fields.  I have field 3 set up with "field1*field2/1000.  The end result of field 3 is rounded up which is good.  However, I know need field 4 to multiply the end result of field 3 (rounded up figure) by a number.  Have tried many different ways but I can't get the rounded up number for the multiplication.  Can anyone help me?  Hopefully someone can even understand my question.  Thanks!!

    You need to be aware that the formatted display of a field is not the same as the value of the field.
    You need to round the result of the computation. Be aware that the Math.round method is designed for integers and not floating point numbers.
    var Field1 = this.getField("field1").value;
    var Field2 = this.getField("field2").value;
    var nResult = Field1 * Field2  / 1000;
    console.show();console.clear();
    console.println("field1 * filed2 / 1000 = " + nResult);
    console.println("formatted and rounded value of field1 * filed2 / 1000 = " util.printf(%,0 3.0f", nResult));

  • I am sure that I am missing something very simple Please Help

    I have all but finished this little program , but for some reason I am getting an error on the last "System.out.println" statement.
    public class ABCInput
         public static void main(String[] args) throws Exception
              char choice;
              while(choice == 'A' | choice != 'B' | choice == 'C' | choice == 'Q')
              System.in.read();System.in.read();
              System.out.println("Please enter one of the following: A, B, C, or Q.");
              choice = (char)System.in.read();
                   if (choice == 'A' || choice == 'B' || choice == 'C')
                        System.out.println("Good Job!");
                   else if(choice == 'Q')
                        System.out.println("Have a nice day!");
                        System.exit(0);
                   System.out.println("Entry must be A, B, C, or Q(quit)");
    Error messages:
    <identifier> expected
                   System.out.println("Entry must be A, B, C, or Q(quit)");
    cannot resolve symbol
    symbol : class out
    location: class java.lang.System
                   System.out.println("Entry must be A, B, C, or Q(quit)");

    It looks like your println statement is outside of the 'main' method.
    Try this - I've made a few changes, which seems to work OK
    import java.io.*;
    public class ABCInput
      public static void main(String[] args) throws Exception
        String choice;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        do
          System.out.println("Please enter one of the following: A, B, C, or Q.");
          choice = br.readLine().toUpperCase();
          System.out.println(choice);
        } while("ABCQ".indexOf(choice) < 0);
        if (choice.equals("A") || choice.equals("B") || choice.equals("C"))
          System.out.println("Good Job!");
        else if(choice.equals("Q"))
          System.out.println("Have a nice day!");
        System.exit(0);

  • Forgot to do something simple - please help!

    I just unboxed a new 27" iMac yesterday. I've been following the support pages
    regarding updated drivers for this model being needed to install Windows 7 under
    boot camp. I followed the steps laid out in the knowledge base - copying drivers
    to a USB drive, having that plugged directly into the iMac as I unstalled 7 (Ultimate 64-bit).
    The install appears to have gone just fine. I can log in OK and my peripherals seem to work OK
    (except for stubborn problem with my BT mouse - same as in XP). But it seems the boot camp
    software - the program that, among other things, instructs the computer to reboot in OS X is
    nowhere to be found. I apparently haven't installed Boot camp software on the windows side.
    Do I install Bootcamp software from my snow leopard DVD, as I did on my XP install? Does that risk overwriting the drivers from my thumb drive and messing up that install? Do I run something on the thumb drive instead?
    Many thanks in advance.

    I wound up having to install Win 7 32 bit.

  • Help with simple Javascript calculation please

    Hello, I've created a form for my company that contains measurements in meters for shipping.  I need to have the total of the measurement appear in the cube/M3 field.  For example, 6.17*3.02*3.35 returns NaN - it should return 62.42.  My fields are called Measure1Row and CubeM31Row.  This field will also be calculated as a total which I had no problem setting up. Under simplified field notation I entered = Measure1Row and it didn't work.  I also tried Measure1Row * 1.  Can someone please help me out?  Thanks so much!

    Hi George,
    I want the product of this measurement 6.17*3.02*3.35 (in meters) to appear in theCubeM31Row.  There are only 2 fields that are affected by this calculation - Measurement and Cube/M3.  The form fields are Qty, Commodity, Measurements, lbs, kgs and Cube/M31Row.  The measurement appears in one field - the other fields contain calculations that match and produce the correct answer.  Does that help?  I'm stumped.

  • HT1800 How can I add a Epson Stylus SX445w to my mac Book Pro this is the second one I've tried and failing miserably...it should be so simple...spoken to the help line at Epson and they say it's down to Apple !! Somebody please help me

    How can I add a Epson Stylus SX445w to my Mac Book Pro
    This is the second one I've tried and failing miserably...it should be so simple...I've installed poken to the help line at Epson and they say it's down to Apple !! Somebody please help me

    Yes I did everything that I was instructed to do!
    Cheers
    Joyce

  • Please help me...Javascript question

    Hi everyone,
    what i am trying to do is..
    EX:
    TABLE: EMP
    empno empname sal entered_by
    1 john 1000 user1
    I have a form on the table EMP.The users want to enter the same record again(because mutiple users enter the same record) but want an alert message when they hit the create button like.. Eg:
    when user2 is trying to enter this data..
    empno: 2 (generated by sequence)
    empname: john
    sal: 1000
    he wants to see an alert message like: THE Record is Already exists in the database which was entered by USER1 (But he can enter the same record)
    what i did is.. I have a javascript which calls the application process (PL/SQL) where it check whether the data entered is already there in the database and returns back an alert message like this:
    JAVASCRIPT:
    ==========
    <script language=javascript>
    function  f_insert_record()
            var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=INSERT_RECORD',0);
            get.add('P2_EMPNAME',html_GetElement('P2_EMPNAME').value);
            get.add('P2_SAL',html_GetElement('P2_SAL').value);
            gReturn = get.get();
            var a = gReturn.split("|");
            if(gReturn)
                if (a.length > 0) {alert(a[0]);}
            else
                null;
    </script>APPLICATION_PROCESS
    ===================
    DECLARE
       l_error   VARCHAR2 (4000);
       V_NAME VARCHAR2(1000);
       V_MSPR_ID NUMBER(15);
       I NUMBER;
       V_MYNUM STRING_OBJ := STRING_OBJ();
    BEGIN
      FOR C1 IN (SELECT DISTINCT entered_by ENTERED_BY_USER_NM 
    from emp 
    WHERE  
      empname = :P2_EMPNAME
      AND sal  = :P2_SAL
      ) LOOP
        V_MYNUM.EXTEND;
        V_MYNUM(V_MYNUM.COUNT) := C1.ENTERED_BY_USER_NM;
      END LOOP;
      V_NAME := NULL;
      l_error := NULL;
      FOR I IN V_MYNUM.FIRST..V_MYNUM.LAST LOOP
        --dbms_output.put_line(V_MYNUM(I));
        V_NAME := V_NAME || '   ' || V_MYNUM(I);
      END LOOP;
      IF V_NAME IS NOT NULL THEN
        l_error := 'The record already exists in the database which was created by '||V_NAME;
      END IF; 
      HTP.PRN(l_error);
    END;everything works fine...when i have a ONBLUR event on the SALARY field.
    But i want the same thing to be achieved with the ONCLICK event on the CREATE button (Template based button).
    The code i have shown over here is just an example...But the requirement is the same..Multiple Users can enter the same record but they want to see an alert message like this record was entered by USER1,USER2.
    The only think i am not able to figure out is the ONCLICK event on that create button.
    I tried like this Target: URL
    javaScript:(f_insert_record();doSubmit('CREATE');)
    I am not getting the alert message.
    Please help me to solve this
    thanks
    phani

    damn it! Those little quotation marks.....
    I already did figure it out awhile after I posted my question
    Thanks anyway!

  • Simple array comparison not working. Please HELP!

    I have been struggling to solve this problem for a few days now, and I'm slowly losing my mind.
    I am in Adobe Acrobat 10.
    I have a group of button fields called: btn0, btn1, btn2, etc.
    I have a group of text fields called: txt0, txt1, txt2, etc.
    I have a script that takes the value of txt0 and makes it the caption for btn0, and so on.
    I have a script that sets the MouseUp action of btn0 to setFocus to txt0, and so on.
    These scripts work fine.
    I have a script that takes the values of all the txt fields and puts them in an array, and sorts it.
    I have a script that takes the array[0] item and makes it the caption for btn0, and so on (alphabetizing my list of buttons).
    Those scripts work fine.
    I am trying to compare the value of the array[0] item to each of the txt fields to find the match, and then set the MouseUp action of btn0 to setFocus to the matching txt field, and so on (so my alphabetized list points to the correct locations).
    This is where I'm at a loss.
    Here is what I have:
    //specified the txt fields
    var txt0 = this.getField("Z name");
    var txt1 = this.getField("A name");
    //etc.
    //put their values into an array called rxArray
    var rxArray = [txt0.value, txt1.value]; //etc.
    //sorted the array
    rxArray.sort();
    //set the captions equal to the sorted array items
    for (var i = 0; i < 5; i++) {
        var b = ("btn" + i);
        this.getField(b).buttonSetCaption(rxArray[i]); //works fine; alphabetizes the list of buttons
        //below is what goes wrong
        for(var x = 0; x < 5; x++) {
            var r = ("txt" + x);
            if(rxArray[i] == r.value){
                var s = (r + ".setFocus();");
                this.getField(b).setAction("MouseUp", s);
    //end
    Here is what I know:
    The alphabetizing and labeling works fine, but the buttons' MouseUp scripts don't work at all. Nothing happens.
    If I change the following piece of the above script:
            if(rxArray[i] == r.value){
                var s = (r + ".setFocus();");
                this.getField(b).setAction("MouseUp", s);
    To this:
            if(rxArray[i] == txt1.value){
                var s = (r + ".setFocus();");
                this.getField(b).setAction("MouseUp", s);
    Because rxArray[0] does equal the value of txt1 ("A name"), then the MouseUp script for btn0 gets set to:
    txt4.setFocus();
    So I know that, each time the nested loop runs, the if statement is true, and the setFocus script updates. Until the end of the loop, leaving the setFocus as the last item run. So why doesn't my script work? It should only update the setFocus script IF the array item matches the txt field, and should set it to THAT txt field.
    Please please help. I know I'm missing something simple in there somewhere.

    @Try67:
    That's a good question. I was running into some other issues and have revamped my code. Here is what I have in my test file:
    A list of five buttons and a list of five text fields. One additional button that sets the focus to the next empty text field to add a new item, and two additional buttons, one that sorts my list alphabetically, and one that unsorts it.
    with the following field names
    The sort button calls function sortName and the unsort calls function sortNumber (the order of entry).
    Here are those scripts in final form:
    function sortName() {
    //first reset the captions for the buttons to blank
    for (var a = 0; a < 5; a++) {
        var b = ("btn" + a);
        this.getField(b).buttonSetCaption("");
    var txt0 = this.getField("t0");
    var txt1 = this.getField("t1");
    var txt2 = this.getField("t2");
    var txt3 = this.getField("t3");
    var txt4 = this.getField("t4");
    var rxArray = [txt0.value, txt1.value, txt2.value, txt3.value, txt4.value];
    for(var m = rxArray.length - 1; m > -1; m--){
        if(rxArray[m] == ""){
            rxArray.splice(m, 1);
    rxArray.sort();
    var newArray = [txt0, txt1, txt2, txt3, txt4];
    for(var n = newArray.length - 1; n > -1; n--){
        if(newArray[n].value == ""){
            newArray.splice(n, 1);
    for (var i = 0; i < rxArray.length; i++) {
        var b = ("btn" + i);
        this.getField(b).buttonSetCaption(rxArray[i]);
        for (var x = 0; x < newArray.length; x++) {
            if(rxArray[i] == newArray[x].value){
                var s = ("this.getField('" + newArray[x].name + "').setFocus();");
                this.getField(b).setAction("MouseUp", s);
    //end
    function sortNumber() {
    var txt0 = this.getField("t0");
    var txt1 = this.getField("t1");
    var txt2 = this.getField("t2");
    var txt3 = this.getField("t3");
    var txt4 = this.getField("t4");
    var newArray = [txt0, txt1, txt2, txt3, txt4];
    for (var x = 0; x < newArray.length; x++) {
        var b = ("btn" + x);
        this.getField(b).buttonSetCaption(newArray[x].value);
        var s = ("this.getField('" + newArray[x].name + "').setFocus();");
        this.getField(b).setAction("MouseUp", s);
    //end
    As you can see, I've used the array lengths rather than fixed numbers, except when clearing the button values. I use a number there because there is no array to reference and didn't feel like making an array just for that. The number of buttons won't change.
    I've also added in a splice() method to remove the blank entries from my arrays when appropriate (making using the array length even more important).
    The result of the sort is:
    The only quirk I've found in all this is with the Add New button, which calls function addNew, which is:
    function addNew() {
    var txt0 = this.getField("t0");
    var txt1 = this.getField("t1");
    var txt2 = this.getField("t2");
    var txt3 = this.getField("t3");
    var txt4 = this.getField("t4");
    var newArray = [txt0, txt1, txt2, txt3, txt4];
    for (var i =  newArray.length - 1; i > -1 ; i--) {
        if (newArray[i].value == "") {
            newArray[i].setFocus();
    //end
    For this, I would have though that running through the array from start to finish looking for the first empty text field and setting the focus to it would have been correct. But that resulted in the last empty text field being focused. So I reversed the for loop to run finish to start, and the result was that the first empty field was focused. Not sure why that is...

  • Hi can someone keep this simple for me! my iPhone is due for a renewal. but my old laptop that it is backed up to no longer works! how do i go about saving all my songs pics etc to a new laptop without losing anything? please help!!!

    hi can someone keep this simple for me! my iPhone is due for a renewal. but my old laptop that it is backed up to no longer works! how do i go about saving all my songs pics etc to a new laptop without losing anything? please help!!!

                     Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • Can you please help to understand how the firefox decides on the Expires date for a cached javascript file ( my server did not set any Expire header, but firebox set it down).

    # Question
    Can you please help to understand how the firefox decides on the Expires date for a cached javascript file ( my server did not set any Expire header, but firebox set it down). I tried to understand but different javascript file gets different Expires date value when it is being cached. Please help me as I tried lot and could not get proper answer for this. Thanks in Advance.

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • Browser is not allowing sign in to excite web page. it says my settings are configured to disable cookies and/or javascript. please help

    i just got firefox 4.0, and i tried to simply sign in to myexcite.com, but instead the message "the browser you're using is not allowing you to sign in to Excite. Right now , your browser's settings are configured to disable cookies and/or javascript..."
    Please Help. I am new to Firefox 4.0

    First, create a specific [[Managing profiles|profile]] for Firefox 4.0b8 to prevent interferences between current (Firefox 3.6) and beta (Firefox 4.0b8) versions.
    Then, see [[Cannot log in to websites]].

  • Please help. Javascript to open/place a file onto an open document to a specific layer

    Hello,
    I would like a javascript that would open and place a PDF file to an active document in Illustrator. I would like it to place it to a specific layer, align it to the art board, and then embed it. Can someone please help?
    Thanks in advance.

    This should be close to what you want:
    var sampleFile = new File( Folder.desktop.fullName + "/SampleFile.psd");
    if (sampleFile.exists) { app.open(sampleFile); }
    else { alert("Could not locate sample file on the desktop."); }
    Tested it out on a Windows machine with no problems.

  • Can't run very simple DOM parsing source on my machine - please help :(

    Hi Guys,
    I am trying to run the following very simple program on my machine to parse a very simple XML file.
    It just returns Document object NULL.
    Same code is working fine on another machine.
    Note: there is no silly mistake. i have valid xml file at valid place.
    Please help.
    import org.apache.xerces.parsers.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import java.io.*;
    class XML
         public static void main(String[] args)
              try{
                   String caseFile = "c:\\case-config\\config.xml";
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   factory.setValidating(true);
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   Document doc = builder.parse(caseFile);
                   System.out.println("\n\n----" + doc);
              }catch(Exception e)
                   e.printStackTrace();
    }

    You could also work with JDOM, which I find easier to use than regular DOM:
    import org.xml.sax.InputSource;
    import java.io.FileReader;
    import org.jdom.input.SAXBuilder;
    import org.jdom.Document;
    String caseFile = "c:/case-config/config.xml";
    InputSource inputSource = new InputSource(new FileReader(caseFile));
    SAXBuilder builder= new SAXBuilder();
    Document document = builder.build(inputSource);Just an alternate suggestion.

  • Please help me with simple program

    Can someone please write a simple program for me that opens up a webpage in the center of the screen , with a set size, and then asks the user where they would like to click on the screen. Then once the person clicks it asks how many times they would like to click there, and then once they enter the # the program opens up the webpage (in the center at the same spot as before, with the same set size) and automatically clicks on the predesignated spot , and then closes all open internet windows, and keeps doing it for however many times the person chose. PLEASE HELP ME WITH THIS!!! If you could, please post the source code here. Thank you so much to whoever helps me!!!!!!!

    If it's not to learn, then what is the purpose of
    this project?well, if it's not HW and its not for learning java, then why the hell would anyone like to have a program that may open a webpage and then repeatedly click on predefined place...
    let me see...
    now if he had asked for program that fakes IP as well, then i would suggest that he tryes to generate unique clicks, but now... i'm not sure... maybe just voting in some polls or smthing... though, i would not create a program that clicks on the link or form element, but rather just reload url with given parameters for N times...

Maybe you are looking for

  • 'alias required in SELECT..'  - Why can't I see this?

    Please help I'm going mad here! The error message is: ERROR at line 1: ORA-06550: line 113, column 37: PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names ORA-06550: line 113, column 37: PL/SQL: Item ignored ORA-06550:

  • How to select multiple pages to export from one document to another

    Have a 200 + page doc, would like to select about half to place in another doc. An earlier post advised selecting the required pages in thumbnail view and copy and paste into second doc. No problem with single page that way but how to select the mult

  • M1217mfw with readiris device not installing correctly

    I run Win7/64 bit.  M1217nfw device.  trying to download Readiris.  It downloaded (4 times actually) and each time hangs on setting the scanner.   I tried reinstalling my printer (don't have the CD, but downloaded and installed M1210 series printer s

  • HT1178 scan cannot find time capsule for new set up

    I have connected airport time capsule with ethernet cable direct to the computer, but the scan for the new time capsule comes up with nothing. Can anyone suggest a way to scan manually when manual scan button is greyed out. Thanks

  • Can't Convert Wav to AAC

    I have been adding my lecture files (Olympus Digital Wave player) to my iTunes for several semsters now. I realized that I needed to convert the wav files to AAC files in order for my iPod to play them. For some reason, I have not been able to conver