Javascript Help Needed Again

Hi there, I am not very good with Javascript, so was looking
for some help.
I have a select list for an order checkout page, which is
basically how
people heard about the site. You select one, and depending on
what it
is, another form field will appear with a message asking for
more detail.
For instance, if they selected Search Engine, another field
would appear
with the text "Which search engine" and a form field for them
to enter
it into.
What is the best way to do this? Some of the options in the
select list
won't need the additional field.
Cheers,
Steve

Dooza wrote:
> Dooza wrote:
>> Hi there, I am not very good with Javascript, so was
looking for some
>> help.
>>
>> I have a select list for an order checkout page,
which is basically
>> how people heard about the site. You select one, and
depending on what
>> it is, another form field will appear with a message
asking for more
>> detail.
>>
>> For instance, if they selected Search Engine,
another field would
>> appear with the text "Which search engine" and a
form field for them
>> to enter it into.
>>
>> What is the best way to do this? Some of the options
in the select
>> list won't need the additional field.
>
> Ok, I have almost got this sussed, just need some syntax
help :)
>
> function toggleElement(sel1, element1) {
>
> element1 = document.cart.elements[element1];
> //alert(element1.value);
> if (sel1.value == 'searchenginelisting') {
> element1.value = 'Which search engine?';
> element1.style.display = 'inline';
> }
> if (sel1.value == 'searchenginesponsored') {
> element1.value = 'Which search engine?';
> element1.style.display = 'inline';
> }
> if (sel1.value == 'banner') {
> element1.value = 'Which website?';
> element1.style.display = 'inline';
> }
> else {
> element1.value = ''; // input text will be empty
> element1.style.display = 'none'; // hide text element
> }
> return;
> }
>
> It currently only works when you select banner from the
select list.
> When you select the first 2 it does nothing. Its the way
its nesting the
> IFs, can anyone tell me how to sort this out?
>
> Cheers,
>
> Steve
function toggleElement(sel1, element1) {
var element1 = form.elements[element1];
if (sel1.value == 'searchenginelisting' ||
sel1.value == 'searchenginesponsored'){
element1.value = 'Which search engine?';
element1.style.display = '';
return;
if (sel1.value == 'banner') {
element1.value = 'Which website?';
element1.style.display = '';
return;
element1.value = ''; // input text will be empty
element1.style.display = 'none'; // hide text element
Mick

Similar Messages

  • Math.min JavaScript help needed

    Hello,
    I am trying to write a script for a fillable PDF in Adobe Acrobat, but I don't have much experience with JavaScript and I need some help!
    Basically I have three fields as follows:
    A1 = a field with a number value in it
    B1 = a field with a number value in it
    C1 = a field where the sum calculation will be.
    I want to write a script that will enter the lesser of the values in A1 and B1 into C1. If no value has been entered into B1, then it enters the value of A1 into C1.
    This is what I have come up with so far:
        // Get the field values, number fields as numbers
        var d1 = getField("A1").value;
        var d2 = +getField("B1").value;
        // Set the field value to either A1 or B1, whichever is lesser
         event.value = Math.min(d1,d2);
    Some of the problems with the script so far are:
    It does not calculate correctly if there is no value entered in B1 (should give just A1).
    It doesn't update the event.value if A1 is changed (until another form field is modified)
    Can anyone help??
    Thanks!

    Adjusted the field calculation order fixed question 2.
    The script given as answer worked great except for one area.
    B1 values can range from 0 and up. If a 0 is entered in B1, then the Math.min ignores it since d2=="".
    I can get around that problem by having a default value set in B1 of -1 (outside of the range). I'd prefer that there not be a default value set.
    Any suggestions? I appreciate the help.

  • If/then JavaScript help needed

    Hello,
    I am trying to write a script for a fillable PDF in Adobe Acrobat, but I don't have much experience with JavaScript and I need some help!
    Basically I have five fields as follows:
    A1 = a checkbox
    B1 = a field with a number value in it
    C1 = a field with a number value in it
    D1 = a field with a number value in it
    E1 = a field where the sum calculation will be.
    I want to write a script that will enter the sum of values of B1+C1+D1 into E1 if the checkbox in A1 is checked yes.
    If it is not checked yes, then it will enter the sum of values of B1+C1+ the value of D1 divided by 2 (and rounded down) into E1.
    Can anyone help??
    Thanks!

    This should do it as the custom Calculate script for E1:
    // Custom calculate script
    (function () {
        // Get the field values, number fields as numbers
        var a1 = getField("A1").value;
        var b1 = +getField("B1").value;
        var c1 = +getField("C1").value;
        var d1 = +getField("D1").value;
        // Set this field (E1) value based on the state of the check box
        if (a1 === "Off") {
            event.value = b1 + c1 + d1;
        } else {
            event.value = b1 + c1 + Math.floor(d1 / 2);

  • Javascript Help Needed to Show/Hide Regions

    version 4.0.2.00.07
    Hello,
    I'm hoping that someone would help me with creating a Javascript function to Show/Hide regions.
    I have a Select List defined as Checkboxes that when clicked I would like to show specific regions that contain fields that are specific to that checkbox selection. There are currently four selections available. There are two selections that would show one region and the other two selections would show the other region.
    Please let me know if I need to clarify anything.
    Thanks,
    Joe

    There is an out-of-box solution that may help you - check out the "Customisation" section in the region properties.
    Otherwise, you might like to explore using a Dynamic Action to show/hide your region based on an event on your relevant checkbox.
    Either way, you should have a declarative solution when you thought you might need to hand-code some javaScript :-)
    ps - thanks for providing your Apex version.

  • Javascript help needed (confirmation for cancel button )

    Hi guys!
    I am not good at javascript but am going to improve shortly :-). Now i need very quick fix.
    I'm using <html:cancel> button in Struts 1.1 and I'm using without thinking the following code:
    <html:cancel onclick="bCancel=true;" >
    <bean:message key="cancel.operation"/>
    </html:cancel>
    It is not that important though. I would like very much to alert user on possible loss of data (long multipaged form - could press mistakingly, who knows).
    Would you, please post the javascript code that is needed to accomplish this - just alert and if yes - cancel, no - leave alone?
    I'll really appreciate this.

    Thank you for your response.
    I also manage to write this. Is this correct?
    <script language="JavaScript">
    function ensure() {
    return confirm("Are you sure that you want to cancel this operation?");
    </script>
    <td colspan="3" align="center">
    <html:cancel onclick="bCancel=ensure();" >
    <bean:message key="cancel.operation"/>
    </html:cancel>
    </td>

  • Images with hyperlink in javascript - help needed

    Hai,
    I am having two hyperlinks say, "Good Morning" and "Good Evening". When I am clicking "Good Morning", a small arrow or a picture should display with the hyperlink.
    When I am clicking "Good Evening" this one should have the small arrow or a picture and "Good Morning" will be displayed normally (without picture).
    How can I do this using javascript?
    Did anyone has the code? Pls help me.
    <html>
    <head>
    <title>
    Moves the Arrow When Clicked the Headings for Sorting purpose
    </title>
    <SCRIPT language="JavaScript">
    function remove_picture() {
    function set_picture() {
    </SCRIPT>
    </head>
    <body bgcolor="peachpuff" width="90%" align="center">
    <table>
    <tr>
    <td align="left">Good Morning</td>
    <td>Good Evening</td>
    </tr>
    </table>
    </body>
    </html>
    - yogee

    <html>
      <head>
        <style type="text/css">
          #notclicking .highliter {
            display: none;
          #clicking .highliter {
            display: inline;
        </style>
        <script type="text/javascript">
          function showHighliter(elem) {
            elem.id="clicking";
          function hideHighliter(elem) {
            elem.id="notclicking";
        </script>
      </head>
      <body>
        <a href="#" id="notclicking"
           onfocus="showHighliter(this);"
           onblur="hideHighliter(this)">
          <img border="0" class="highliter"
               src="http://forum.java.sun.com/im/duke.gif"/>
          Good Morning
        </a><br/>
        <a href="#" id="notclicking"
           onfocus="showHighliter(this);"
           onblur="hideHighliter(this)">
          <img border="0" class="highliter"
               src="http://forum.java.sun.com/im/duke.gif"/>
          Good Evening
        </a><br/>
      </body>
    </html>

  • Design help needed, again

    I'm developing a database app, which consists of several applets. Some of this applets are only able to show data, and some others are able to both show and modify data.
    Now I need to write a new applet to manage the security of the whole app. This applet will allow the users to log in (with their username and password) and, once the login is validated, it will enable the rest of the applets. If this security applet is ever closed, all the other applets should stop working.
    Any ideas on how to implement this ?
    Thanks !

    You can use the applet context class to deal with
    inter-applet communication (google for that, you
    should find something). But, I would maybe go toward
    a JSP/Servlet based solution for this and let your
    container take care of the security bit, plus it gives
    you a session to keep the login token info in. You
    could still use applets if you need the rich UI, but
    stick them in a JSP and lean on the session and
    request objects to hold your login token data.
    That was completely off the top of my head, so I hope
    a) it's accurate and b) it's helpful
    Good luck
    LeeThanks for your reply Lee.
    I think that the method you sugest is something like the sessions under PHP, which I'm sure will solve my problem.
    The thing is, my project consists of creating some applets that will enable other people to create customized database management apps. They would only need to create a web page and insert the applet that shows this thing, the applet that does that other thing, etc, etc. But in order for all the applets to work, the developer will insert the applet that validates the user login and unlocks the rest of the applets (maybe, for example, providing them with a database connection).
    With this approach, the developer does not need to know how to pogram JSP, PHP, ASP,etc. He/she only needs to insert the applets on a web page and that's it.
    That's why I want to do the job using an applet.

  • Javascript help needed if possible

    I am trying to combine code from codaslider and shadowbox, but whatever I try, my code is basically rubbish!!
    I want to combine the following two links in to one:
    <a rel="shadowbox[Mixed];width=640;height=360" href="#">
    <a class="xtrig" href="#1" rel="coda-slider-3">
    I am fairly certain that all I need to do is combine the two 'rel=' parts of the code to get it working. Basically, what I am trying to do is stop codaslider from sliding when I click and instigate the shadow box. Is it possible?
    TIA
    Mat

    No, it can't be done. JSP code runs before the HTML page is generated; it's a server side technology. JavaScript runs on the client's machine, after the page has been rendered.

  • Javascript Help needed

    We have a requirement to not display report until the user selects some requirements, and we also need to ensure a user has selected a value for certain prompted columns.
    As such, we have written a custom Javascript for a custom "Go" button on our dashboards. The JS validates the required fields and generates a Go URL which loads into an iFrame when the custom button is clicked. This works fine in Internet Explorer, but in Firefox the prompt values are not being passed into the Go URL string. This is a security risk as it shows all data on the report when it shouldn't for certain users. Can anyone look at the JS code below to see why it won't work in Firefox?
    Thanks
    removed code, sorryEdited by: odinsride on Feb 10, 2011 9:17 AM

    if(navigator.appName == 'Microsoft Internet Explorer')That would be the reason your code doesn't work in Firefox - most of it is inside an IE-only if clause!
    Surely there must be a better way to achieve your requirement rather than to use all that javascript. One technique I've used to force a user to make a prompt selection is to use nonsensical default values on your prompts. By doing this you are guaranteed that the report will give 'no results' when it is first run. You can then add a no results view to the report and add your own custom message saying 'please make some selections from the prompts above'.

  • Tom Help needed again!!!!!!!!JMS Failure Applet

    Hi Tom,
              In my application applet is basically the client and it basically does the following
              1)Creates an initial context with the provider url
              2)Looks up for the Topic connection factory
              3)Then using the TopicConnection Factory creates the Topic
              Now the problem is in some of the PC's it gives the following error. at the first step while creating the initial context,pls note that the provider url is correct and we use http protocol with http tunneling enabled.
              javax.naming.NamingException: Couldn't connect to any host [Root exception is org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No]
              at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:81)
              When i placed a .java.policy file with grant {
              permission java.security.AllPermission;
              }; in the c:\documents.settings\<username> folder.After doing this it seems to work in some of machines where the above mentioned error is
              occurring.Pls note that my applet is a signed one, and the network does not have any firewall
              My query is do we have to place this .java.policy file in every client machine and why is that it is not working in all the machine where the above mentioned error is coming.
              Pls help me in solving this problem.
              Pls also note that we have admin rights also on all these machines.

    I don't know the answer. The best I can think of is to read the JMS applet white-paper if you haven't already:
              http://dev2dev.bea.com/pub/a/2004/05/WLS_81_jms_applets.html
              Tom

  • Help needed! Raid degraded again!

    Hi!
    Help needed! I hava made bootable RAID with two S-ATAII 250Gb HDD and its not working! Every now and then at bootup I get a message RAID -> DEGRADED... Must be seventh time! Rebuild takes its own time!
    What am I doing wrong!
    T: Ekku
    K8N Neo4 Ultra
    AMD 64 4200+
    2 Gb RAM
    2 x 250 Gb HDD (Maxtor)
    nVidia RAID (in mb)
    P.S. I wery SORRY with my poor language!

    I'm going to blame the nVRAID because I've seen issues with it in the past. If your motherboard has another non-nVidia RAID solution, use that instead. Using the nVidia SATA ports as BASE or JBOD is fine and dandy but RAIDing always had issues. It's not even a driver issue I think it's just instability. Latest drivers and even boxed drivers never helped. Granted, some will report success with their rig. But on a professional level I've seen nForce issues on different motherboards and different hard drives that had RAID disaster stories.
    Good luck and if you don't have another RAID solution, my suggestion would be to buy a dedicated RAID controller card.
    LPB

  • Help needed with Vista 64 Ultimate

    "Help needed with Vista 64 UltimateI I need some help in getting XFI Dolby digital to work
    Okay so i went out and I bought a yamaha 630BL reciever, a digital coaxial s/pdif, and a 3.5mm phono plug to fit perfectly to my XFI Extreme Music
    -The audio plays fine and reports as a PCM stream when I play it normally, but I can't get dolby digital or DTS to enable for some reason eventhough I bought the DDL & DTS Connect Pack for $4.72
    When I click dolby digital li've in DDL it jumps back up to off and has this [The operation was unsuccessful. Please try again or reinstall the application].
    Message Edited by Fuzion64 on 03-06-2009 05:33 AMS/PDIF I/O was enabled under speakers in control panel/sound, but S/PDIF Out function was totally disabled
    once I set this to enabled Dolby and DTS went acti've.
    I also have a question on 5. and Vista 64
    -When I game I normally use headphones in game mode or 2. with my headphones, the reason for this is if I set it on 5. I get sounds coming out of all of the wrong channels.
    Now when I watch movies or listen to music I switch to 5. sound in entertainment mode, but to make this work properly I have to open CMSS-3D. I then change it from xpand to stereo and put the slider at even center for 50%. If I use the default xpand mode the audio is way off coming out of all of the wrong channels.
    How do I make 5. render properly on vista

    We ended up getting iTunes cleanly uninstalled and were able to re-install without issue.  All is now mostly well.
    Peace...

  • Help needed please, with Iphone stuck with apple picture and progress bar after software update attempted

    Help needed please, everytime I try to update the software version on my iphone it comes up with a message saying it could not be completed and is now frozen with the apple picture and progress bar on it. Do I unplug it and hope the macbook pro sees it again, I also stupidly did not back up before starting the download which I realise I will have to go back to the previous back up. This keeps happening, everytime I do this type of update, I'm starting to think I should just give up on updating my software on the Iphone. I thought it was happening because I was using a window based computer to do the updates, this time I used my Macbook Pro. Please somebody help

    ljm17 wrote:
    ...This keeps happening, everytime I do this type of update, I...
    Then you should know what you need to do... If you don't remember...
    See Here  >  http://support.apple.com/kb/HT1808

  • URGENT HELP NEEDED ... Tomcat Realm and JRE1.4 plug-in problem

    I have tried the Security Realm of Tomcat. Since I do not have
    an LDAP server, I decided to use the Tomcat-users.xml file in
    Tomcat\conf directory.
    I added the following lines of code in the web.xml file.
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Entire Application</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <!-- NOTE: This role is not present in the default users file -->
    <role-name>webviewer</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Tomcat Manager Application</realm-name>
    </login-config>
    The <role-name> "webviewer" is added into "Tomcat-Users.xml" as the following:
    <tomcat-users>
    <user name="test" password="password" roles="webviewer" />
    </tomcat-users>
    So, now when we type the url: http://localhost:8080/adbpdbre/default.htm, TOMCAT shows a dialog box asking for UserName: and Password:Now, only when we give the username and password, it shows the page. This is exactly what we want.
    But the problem now is, this default.htm page, has 5 links to 5 applets. The first time that I click on one of these links, the JRE plug of 1.4 shows a dialog again asking for the username and password. Till I dont provide the username and password the system doesnt go ahead and applet doesnt load. I do not want the JRE to ask me for the username/passwords again..How to avoid this ?
    Can you give me some more information on this. Ultimately in the production usage, we will be using LDAP and not Tomcat's memory realm.
    URGENT HELP NEEDED ... I need to get back to my client on this.
    Help would be v. much appreciated.

    In the config file, you 're essentially saying that you want Tomcat to prompt for usr/passw on every request (url-pattern = /*) made by a 'webviewer', and that's exactly what Tomcat is doing.
    Consider using specific url-patterns & roles for resources to be protected. If for now, all you need is to protect the first page, use a more specific url-pattern.
    Just an advice : if you'll be using LDAP in production, do not waste time with Tomcat's Security Realm and the BASIC authentication type, since the two have not much in common. Start reading doc on LDAP, and code a prototype, or even better, a vertical slice of the app (i.e a proof of concept).

  • URGENT HELP NEEDED - iPhone 3Gs no longer detected or charged by MacBook

    My iPhone 3Gs (3.1) has been running fine, until several hours ago today, when I plugged it to my MacBook, the iPhone is no longer detected - it doesn't show up in iTunes, nor it is charged. I tried opening iPhoto, and it wasn't there too. Not with Image Capture too. I tried charging it using the out-of-box wall charger using the same out-of-box USB cable I use for MacBook, and it can be charged without any problem. Then I put it into Recovery mode, and there iTunes can see it. I don't want to restore it before I figure out exactly what went wrong, as I don't want the restore process somehow gets stuck in the middle that the connection is lost again.
    I've tried reinstalled iTunes, including completely removal of Apple Mobile Device Support, as instructed by Apple. But still no luck.
    I've tried switching to another USB port of my MacBook. No luck.
    My iTunes is the latest 9.0.1, and my Mac OSX is 10.6.1. My iPhone is on 3.1, upgraded from 3.0.
    I've read from web that it seems I'm not the only one out there having this problem. But none of them seem having any real working solution.
    Urgent help needed & appreciated. Millions of thanks in advance.
    Gary

    1. I used both cables - theirs & mine ... and on several macs
    2. yes, same cable for wall & mac
    3. as said, i did completely remove & install itunes (incl. apple mobile device support), as instructed on the apple webpage
    anyway, did a restore just now. it seems okay now. but the problem is i have no idea what cause this, and i can't replicate the problem. so i don't know when it will happen again ... maybe a bug with os 3.1 ... others on web said os 3.1 is quite buggy ...

Maybe you are looking for

  • Rounding up decimal places

    Hi,can anyone please tell me how to round up a double type value to 6 decimal places. Thank You!

  • Performance issue: looping over queries with a query results set

    I have code that works, but I think I should be able to run the code faster. I could try a stored procedure but there are so many variables to set. I tried with wrapping cftransation around the code, but it didn't make a noticeable difference. I need

  • Time Machine fails - cannot make backup folder

    For the past two weeks I've been having some major issues backing up my computer with Time Machine. It's become quite a process. iMac 27" Mountain Lion I am backing up to a brand new - well bought in February, '14 - 1TB external hard drive and there

  • Ipod not charging or syncing

    My ipod touch 3rd gen 8gb is not charging or syncing to itunes.  ALL i get is a red battery when I plug it in and then the apple sign, but never charges or syncs.  What can I do and what is wrong with this?  thank you

  • Implement MQ Grouping in XI

    Hi I want to send messages with MQ GroupID parameter I didnt find it in XI JMS Adapter that's y im using java mapping I have the following code from IBM Website MQConnectionFactory factory = new MQConnectionFactory(); factory.setQueueManager("QM_host