OT: javascript question ... can it be done

Assume: var x = "one_two_three_four";
Is there any way to do the following with only one line of
code?
var tmp = x.split('_'); // tmp =
array("one","two","three","four")
y = x[x.length-1]; // y = "four"

Alexander Ross wrote:
> Assume: var x = "one_two_three_four";
>
> Is there any way to do the following with only one line
of code?
>
> var tmp = x.split('_'); // tmp =
array("one","two","three","four")
> y = x[x.length-1]; // y = "four"
Look into lastIndexOf() and slice()
HTH,
Thierry
Articles and Tutorials:
http://www.TJKDesign.com/go/?0
The perfect FAQ page:
http://www.TJKDesign.com/go/?9
CSS-P Templates:
http://www.TJKDesign.com/go/?1
CSS Tab Menu:
http://www.TJKDesign.com/go/?3

Similar Messages

  • Raid question, can it be done or not

    hi, and thanks in advance for any help given regarding my question.
    i have two raptors set up as a mirrored raid array, my question is can i go into bios and change them to a stripped array (raid 0) for peformance without having to reinstall xp and if so what are the best settins?

    I can confirm supershanks answer, as i've TRIED it.. and no, if you change ANY of the nVraid settings, you have to reinstall windows..
    I don't think this is the case with all RAID controllers though, as the promise controller on my other board, was more flexible..
    you could just make a ghost image of your current setup, then change the settings, and ghost it back. check my sig for instructions using ghost with nvraid

  • Reports Question -- Can this be done?

    Encrypting a report for distribution in an e-mail
    Report Builder 6.0.8.12.1 Database: 7.3.4
    Hello Everyone!
    Does anyone know how to encrypt a report? This will be batch
    processing of emailing reports using Reports Server.
    Thanks in advance,
    ~Vannette

    Vannette,
    You can send reports over the internet via ssl, but Reports
    itself has no encryption mechanisms.
    Regards,
    The Oracle Reports Team jls

  • Is there a way that you can have two different text fields (email, phone) that one at least one of them must be completed before submitting the form? Can it be done using javascript in the validation tab? if so, how?

    Is there a way that you can have two different text fields (email, phone) that one at least one of them must be completed before submitting the form? Can it be done using javascript in the validation tab? if so, how?

    Here is one solution:
    // mouse up action for submit button;
    function GetField(cName) {
    // get field object for cName field with error checking;
    var oField = this.getField(cName);
    if(oField == null) app.alert("Error accessing field named " + cName + "\nPleae verigy field name, spelling and capitalizeation.", 1, 0);
    return oField;
    } // end GetField function;
    var oPhone = GetField("phone");
    oPhone.required = oPhone.value == oPhone.defaultValue;
    var oEmail = GetField("email");
    oEmail.required = oEmail.value == oEmail.defaultValue;
    if(oPhone.required && oEmail.required) {
    app.alert("Missing required fields.", 1, 0);
    } else {
    app.alert("Submitting form", 3, 0);
    // additional code for submission;

  • I want to change my security questions.  Can this be done and if so --how?

    I want to change my security questions.  Can this be done and if so --how?

    Click here for information. If you've forgotten the answers to the security questions and can't get them emailed to you for some reason, contact the iTunes Store staff via the link in that article.
    (76248)

  • HT1491 I am trying to buy a song on iTunes but it won't let me because I need to answer my security questions? But I don't remember the answers how can I change the questions?

    I am trying to buy a song on iTunes but it won't let me because I need to answer my security questions? But I don't remember the answers how can I change the questions?

    Click here and search the article for '2 out of 3' without the quotes; this generally involves either a message being sent to your rescue email address or contacting the iTunes Store staff directly.
    (74487)

  • JAVASCRIPT:  Accessing the sessionbean - how ??? can it be done?

    Hi,
    I need to access the sessionBean from javawscript. I have trawled throughj all posts and have got no satisfactory code.
    Can this be done?
    I have tried for eg alert(#{sessionBean.firstName}) and get a syntax error, i assume due to # symbol. do i need to CDATA this request?
    Any help, much appreciated.
    Regards,
    LOTI

    Your problem is trying to access server side information from the client side, so that alert is never gonna work in that simple form. If you want javascript access to a sessionbean variable, that variable will have to be present in the final rendered page....meaning bring it into your page as either a visible or inviisble field and then using javascript to read that. Thats one solution?

  • I can't remember my security question answers and I don't know what to do

    I can't remember my security question answers and I don't know what to do

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (103304)

  • HT201363 I don't remember my questions can u please help me

    I don't remember the answers to my security questions can u help my trying to down load music

    1)  Apple ID: All about Apple ID security questions
    2)  See Here... ask to speak with the Account Security Team...
    Apple ID: Contacting Apple for help with Apple ID account security
    Or Here  >  Apple  Support  iTunes Store  Contact

  • HT5312 I forget the answers of security questions and i don't have rescue email how can i reset security questions, especially that i don't have a support from apple in my country lebanon to contact with

    I forget the answers of security questions and i don't have rescue email how can i reset security questions, especially that i don't have a support from apple in my country lebanon to contact with

    Alternatives for Help Resetting Security Questions and Rescue Mail
         1. Apple ID- All about Apple ID security questions.
         2. Rescue email address and how to reset Apple ID security questions
         3. Apple ID- Contacting Apple for help with Apple ID account security.
         4. Fill out and submit this form. Select the topic, Account Security.
         5.  Call Apple Customer Service: Contacting Apple for support in your
              country and ask to speak to Account Security.
    Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    How to Manage your Apple ID: Manage My Apple ID

  • HT5699 I don't know my answers to the identity questions, can you help me?

    I don't know any of my answers to the identity questions, can you help me?

    Go back to the article you asked this question from and use one of the methods of contacting Apple. The people on these boards can't reset your security questions.
    (95441)

  • Need to keep record for each response to each question on quiz. Can this be done outside an LMS?

    For auditing purposes, I need to keep a record of the user's response to each question of a 35 question quiz.
    I don't think my LMS (Halogen) has this capability. Is there a way to keep a record of each slide, outside of screen capturing each response?

    As developing a plugin for Adobe Reader requires a license from Adobe, you will need to send this email into the mailing address found in the Acrobat SDK in the Reader License folder.

  • JavaScript Error : Can't move focus to the control because it is invisible,

    I have one JSP page in my project where i am putting all input to save personal details of a person.
    This personal details header contains button(to collapse or expand).
    I input all details and save. It works fine but when i collapse the header and name, age etc are not visible.
    Only Save and cancel button is visible. so i click on save and following javascript error show up :
    Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
    In case of expand mode,If there is any error while providing input in text boxes , i have given pop up to display that like " Name field is mandatory " and control focus to that field again. it works fine.
    In case of collapse, as fields are not visible and if i directly click on save button. Pop up is displayed as usual "Name field is mandatory" but it pop up again javascript error
    "Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."
    Please let me know how to reolve this?

    1) there is a JSP forum
    2) that still doesn't make it a forum to ask javascript questions
    Please let me know how to reolve this?Who says that you can resolve it? If it isn't allowed, don't try it. Likely you'll have to rethink the design of your page.

  • Additional Pageflow - JavaScript Questions

    I was hoping someone (bea employee???) could answer a couple more JavaScript questions
    for me?? First one is how do I (can I) do something similar to what John Rohrlich
    (see below) suggested inside a netui-data:grid tag? Among other things that didn't
    workI tried this:
    <netui-data:anchorColumn action="deleteUsr" title="">
    <netui:anchor action="deleteUsr" onClick="return confirmDelete('user', {container.item.usr_nm}
    ); return false;">
    Drop
    <netui:parameter name="userToDrop" value="{container.item.usr_nm}" />
    </netui:anchor>
    </netui-data:anchorColumn>
    From this snippet you might be able to guess what my next question is. Is there
    a way to render a variable inside the onClick value? I have tried a number of
    things to no avail, stuff like:
    <netui-data:getData resultId="thisId" value="{container.item.userId}" />
    <netui:anchor action="dropUser" onClick="return confirmDelete('user', '<%=(String)pageContext.getAttribute("thisId");%>');
    return false;">
    BTW this is in a repeater I have else ware in my code. I would really like to
    convert everything to grids to get the sorting, filtering and paging capabilities.
    I would like to be able to pass the parameter to my JavaScript so the user has
    a little more info on what he is dropping - here is the script:
    function confirmDelete(){
    //arg 1 would be the record type i.e. "user"
    //arg 2 would be the key identifier i.e. "Fred"
    var question = "Are you sure you want to drop this record?";
    var argNum = confirmDelete.arguments.length;
    if (argNum == 1){
    question = "Are you sure you want to drop this "+confirmDelete.arguments[0]+"?";
    else if (argNum == 2){
    question = "Are you sure you want to drop the "+confirmDelete.arguments[0]+"
    "+confirmDelete.arguments[1]+"?";
    return confirm(question);
    Thanks,
    John
    "John Rohrlich" <[email protected]> wrote:
    John,
    If you want to put up a confirm dialog before calling an action from
    an
    anchor it is done as follows.
    Here is an example from code of mine that deletes a customer order, if
    the
    user confirms the delete. I pass the order id as a parameter.
    - john
    Here is the JavaScript -
    function confirmDelete() {
    if(confirm('Continue with order delete?'))
    return true;
    else
    return false;
    Here is a sample anchor tag -
    <netui:anchor action="requestToDeleteOrder" onClick="return
    confirmDelete(); return false;">
    Delete
    <netui:parameter name="orderId" value="{container.item.orderId}"/>
    </netui:anchor>

    Thanks Eddie, I looked at that reply when you gave it but it didn't give me enough
    to go on. You suggested:
    <netui-data:expressionColumn title="Show Alert" value="<a href='javascript:alert(12345);return
    false;> {container.item.customername}</a>" />
    I started a new thread after that one - What is the best way to call a pageflow
    action from JavaScript? Guess I was sort of beating around the bush on this. Can
    you see where I was going? If I use the method you describe above how do I call
    my dropUser pageflow action if the user confirms the drop in the java dialog?
    Thanks, John
    Eddie O'Neil <[email protected]> wrote:
    John--
    You might check an earlier response about this from a different thread.
    "Re: Confirmation dialog w/netui:anchor and netui-data:anchorColumn"
    on
    1/28/2004.
    It's possible to do though not intentional; the 8.1 grid wasn't
    really designed to do this.
    The NetUI team is certainly aware of the limitations with using this
    version of the grid and is working to address said limitations with a
    much improved tag set in v9. If you have additional feedback on
    features you'd like to see, please feel free to send them along --
    including your top 10 (or whatever!) reasons not to use the grid. :)
    In the meantime, depending on what you need to do, the repeater may
    suit your needs well, though you may need to do some work to implement
    sort / filter logic.
    Hope that helps.
    Eddie
    John H wrote:
    So what you are telling me is that a cant do somthing as simple aspop up a confirmation
    when using a grid? That really stinks if that is the case. I am thinkingI need
    to write up "Top ten reasons not to use a grid." Thanks for the repeatercode.
    "John Rohrlich" <[email protected]> wrote:
    John,
    The grid doesn't support event handlers like onClick but I have included
    code here to show you how to pass parameters to your javaScript event
    handler when using the repeater. Let me know if you have any questions
    about
    the code.
    Most of the code is standard repeater code. The interesting code is
    below
    (also see my code comments). I have also attached the full jsp fileand
    the
    jpf file you need to try my example.
    - john
    <script language="JavaScript">
    function confirmDelete(phrase) {
    if(confirm(phrase))
    return true;
    else
    return false;
    </script>
    <netui-data:repeater dataSource="{pageInput.orders}" defaultText="No
    orders">
    <netui-data:repeaterItem>
    <tr valign="top">
    <td>
    <netui:label value="{container.item.orderId}"
    defaultValue=" "></netui:label>
    </td>
    <!-- You can't bind data to onClick so you need to build
    a
    string. -->
    <!-- The string will be the function call with the
    parameters you are passing. -->
    <!-- Here is the building of the string -->
    <netui-data:getData resultId="orderId"
    value="{container.item.orderId}" />
    <%
    String somePhrase = "Do you want to delete item " +
    pageContext.getAttribute("orderId") + "?";
    String foo = "return confirmDelete(\'" + somePhrase+
    return false";
    %>
    <td>
    <netui:anchor action="requestToDeleteOrder"
    onClick="<%=foo%>" >
    Delete
    <netui:parameter name="orderId"
    value="{container.item.orderId}"/>
    </netui:anchor>
    </td>
    </tr>
    </netui-data:repeaterItem>
    "John H" <[email protected]> wrote in message
    news:[email protected]...
    I was hoping someone (bea employee???) could answer a couple moreJavaScript questions
    for me?? First one is how do I (can I) do something similar to whatJohn
    Rohrlich
    (see below) suggested inside a netui-data:grid tag? Among other thingsthat didn't
    workI tried this:
    <netui-data:anchorColumn action="deleteUsr" title="">
    <netui:anchor action="deleteUsr" onClick="return confirmDelete('user',{container.item.usr_nm}
    ); return false;">
    Drop
    <netui:parameter name="userToDrop" value="{container.item.usr_nm}"/>
    </netui:anchor>
    </netui-data:anchorColumn>
    From this snippet you might be able to guess what my next questionis. Is
    there
    a way to render a variable inside the onClick value? I have trieda
    number of
    things to no avail, stuff like:
    <netui-data:getData resultId="thisId" value="{container.item.userId}"/>
    <netui:anchor action="dropUser" onClick="return confirmDelete('user','<%=(String)pageContext.getAttribute("thisId");%>');
    return false;">
    BTW this is in a repeater I have else ware in my code. I would reallylike to
    convert everything to grids to get the sorting, filtering and pagingcapabilities.
    I would like to be able to pass the parameter to my JavaScript sothe
    user has
    a little more info on what he is dropping - here is the script:
    function confirmDelete(){
    //arg 1 would be the record type i.e. "user"
    //arg 2 would be the key identifier i.e. "Fred"
    var question = "Are you sure you want to drop this record?";
    var argNum = confirmDelete.arguments.length;
    if (argNum == 1){
    question = "Are you sure you want to drop this"+confirmDelete.arguments[0]+"?";
    else if (argNum == 2){
    question = "Are you sure you want to drop the"+confirmDelete.arguments[0]+"
    "+confirmDelete.arguments[1]+"?";
    return confirm(question);
    Thanks,
    John
    "John Rohrlich" <[email protected]> wrote:
    John,
    If you want to put up a confirm dialog before calling an action
    from
    an
    anchor it is done as follows.
    Here is an example from code of mine that deletes a customer order,if
    the
    user confirms the delete. I pass the order id as a parameter.
    - john
    Here is the JavaScript -
    function confirmDelete() {
    if(confirm('Continue with order delete?'))
    return true;
    else
    return false;
    Here is a sample anchor tag -
    <netui:anchor action="requestToDeleteOrder" onClick="return
    confirmDelete(); return false;">
    Delete
    <netui:parameter name="orderId" value="{container.item.orderId}"/>
    </netui:anchor>

  • TS3988 I changed my Apple ID to my new email address successfully for the iTunes and App store but it won't work for iCloud and it won't recognize my password. I read that this can't be done. How am I supposed to get into iCloud?

    I changed my Apple ID to my new email address successfully for the iTunes and App store but it won't work for iCloud and it won't recognize my password. I read that this can't be done. How am I supposed to get into iCloud? I plan on getting rid of my old email address which is my old Apple ID so how is that going to work?

    Same question Wish someone had replied!
    I changed my Apple ID to my new email and now cannot find any way to access icloud. Unfortunately I had allowed icloud to hijack my airbook files, so of course I am afraid I will lose them tomorrow when I exchange my iphone for a new one and cannot keep an icloud account i cannot access. What a poor sync system! Really atypical for apple!

  • I would like to transfer the balance from one Apple ID to another how can this be done??

    I want to transfer the account ballance from my account to my son's. I unintentionally redeemed one of his gift cards to my account. how can this be done?

    Sorry, but balances can't be transferred from one iTunes Store account to another. You'll either have to make his purchases through your account, or buy another prepaid card and redeem that in his account.
    BTW, for future questions, this forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help if you ask in the general iTunes forums.
    Regards.

Maybe you are looking for

  • Large images not displaying properly in Acrobat Pro 9

    When creating PDF documents from any software (Illustrator, Corel, InDesign, etc), color objects over 50% of the page size have white fill. If object has an outline, the outline will appear normally, but the fill will be white. I've searched forums e

  • -50 download error

    Trying to update my apps through iTunes, and I keep getting an -50 download error on all of them. I don't know if this is related but on top of idiots refusing to sync the iPad these apps are on as well. What's causing this and is there a way to fix

  • How to create the Hierarchy Structure in BeX

    Hi, We have a cost center IOBJ MD, and our source system does not have the feasibility to create hierarchy to load it. But the business gave a hiearchy structure in flat file, and want to get the cost center hierarchy in bex. How do we do that ? Plea

  • How to Insert a new line in a clob

    hi, i want to create reports as multi-line clob data using PL/SQL procedures. is there any standard way of inserting a new line when iam generating this clob data based on the data i fetch from a different table. i short my question is "How to insert

  • Margins cause a slight ripple in the background

    I'm using a 15px margin the top of my header to account for people using browser toolbars and give it a little "breathing room". I noticed that the margin itself causes a slight ripple or "duplication effect" on the background. Is this normal? Grante