Results 1 to 4 of 4
  1. #1
    pankaj_salwan is offline Member
    Join Date
    Jul 2008
    Location
    india
    Posts
    35
    Rep Power
    0

    Default invoking javascript on in jsp

    hi!!

    i have a jsp file and i have to invoke javascript function in jsp file..actually i have a xml file and i had parsed that xml in this function ..i had to invoke value based on the key ..i mean i want that function to return certain value ..following is the function in script tag

    function parseXML()
    {
    try //Internet Explorer
    {
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    }
    catch(e)
    {
    try //Firefox, Mozilla, Opera, etc.
    {
    xmlDoc=document.implementation.createDocument(""," ",null);
    }
    catch(e)
    {
    alert(e.message);
    return;
    }
    }
    xmlDoc.async=false;
    xmlDoc.load("mytext1.xml");
    var x=xmlDoc.documentElement.childNodes;
    for (var i=0;i<x.length;i++)
    {
    if (x[i].nodeType==1)
    {
    //Process only element (nodeType 1) nodes
    document.write(x[i].nodeName + ": ");
    document.write("value="+xmlDoc.getElementsByTagNam e(x[i].nodeName)[0].childNodes[0].nodeValue);
    var y=xmlDoc.getElementsByTagName(x[i].nodeName)[0].childNodes[0].nodeValue;
    document.write("y="+y);
    }
    }
    return(y);
    }





    ........i am invoking this function like this

    <tr>
    <td nowrap width=200>
    <p class="formHeader"><a href="parseXML()">Abone</a> </p>
    </td>
    </tr>

  2. #2
    roots's Avatar
    roots is offline Moderator
    Join Date
    Jan 2008
    Location
    Dallas
    Posts
    293
    Rep Power
    7

    Default

    Where is the problem .. ??
    dont worry newbie, we got you covered.

  3. #3
    pankaj_salwan is offline Member
    Join Date
    Jul 2008
    Location
    india
    Posts
    35
    Rep Power
    0

    Default

    i am not getting expected output..i want to get value based on key as a return value from the function ...

  4. #4
    roots's Avatar
    roots is offline Moderator
    Join Date
    Jan 2008
    Location
    Dallas
    Posts
    293
    Rep Power
    7

    Default

    Try javascript debugger, "Firebug" is good one.
    I think .. a href = "javascript:yourMethodName.." is the proper way of doing it.
    dont worry newbie, we got you covered.

Similar Threads

  1. Invoking Servlet from SWT application
    By wolve634 in forum SWT / JFace
    Replies: 1
    Last Post: 03-30-2009, 12:35 PM
  2. Invoking a MIDlet from a webbrowser
    By islamfunny in forum CLDC and MIDP
    Replies: 3
    Last Post: 10-08-2008, 11:43 AM
  3. Object Reflection: Invoking methods
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-23-2008, 09:14 PM
  4. Invoking superclass methods... how?
    By rhobincu in forum New To Java
    Replies: 7
    Last Post: 08-09-2007, 04:10 PM
  5. invoking method and output questions
    By bluekswing in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 07:36 AM

Posting Permissions

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