Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JBscript to Javascript

    I have some JBscript that i need to be convert to javascript so that i will work with mozilla firefox.

    I can do VB promgramming but not any good at java script.

    Can any one help?

    <select name="Item" onclick='VBScript:UpdateItem form1,form1.item_name,form1.amount'>
    <option selected="selected" value="">Select...</option>
    <option value='Test|20'>test</option>
    </select>

    <script language='VBScript'>
    Sub UpdateItem(myForm,myField1,myField2)

    a=myForm.Test.value
    b=split(a,"|")
    if ubound(b)>0 then
    myField1.value=b(0)
    myField2.value=b(1)
    end if

    a=myForm.Item.value
    b=split(a,"|")
    if ubound(b)>0 then
    myField1.value=b(0)
    myField2.value=b(1)
    end if


    Many Thanks

    Liam

  • #2
    VR2
    VR2 is offline
    New Coder
    Join Date
    Jul 2006
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <Script>
    function main()
    {
        // Set Event handlers here...
        var myForm   = document.getElementById("myForm");
        var mySelect = document.getElementById("mySelect");
        mySelect.onclick = updateItem(myForm, myForm.item_name, myForm.amount);
    }
    function updateItem(myForm, myField1, myField2)
    {
        var a = myForm.Test.value;
        var b = a.split("|");
        if (b.length > 0)
        {
            myField1.value = b[0];
            myField2.value = b[1];
        }
    }
    // Program Start...
    window.onload = main();
    </Script>
    
    ...
    
    <form id="myForm">
    <select id="mySelect">
    <option selected="selected" value="">Select...</option>
    <option value='Test|20'>test</option>
    </select>
    </form>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •