• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Retrieve value without getElementsByTagName or Xpath

Hi Experts,

Writing a greasemonkey / iepro script. How can I get / retrieve the last param tag value ("/images/frontyard.jpg") without using getElementsByTagName or Xpath ?

Just need a simple way to rip out the line "/images/frontyard.jpg" into a string as Xpath doesn't work in IE and getElementsByTagName is kinda buggy as well in IE. Thanks.

Code:

      <applet name="panoviewer" code="panoapplet.jar" width="350" height="280" id=Applet1>
            <param name="alt" value=" ">
            <param name="auto" value="70">
            <param name="view" value="360">
            <param name="zoomangle" value="30">
            <param name="background" value="0, 0, 0">
            <param name="toolbarstyle" value="floating">
            <param name="toolbar" value="disabled">
            <param name="file" value="/images/frontyard.jpg">
      </applet>
0
newbie_coder
Asked:
newbie_coder
  • 2
1 Solution
 
basicinstinctCommented:
something like:

document.getElementById('Applet1').lastChild.value;
0
 
basicinstinctCommented:
or this:

<html>
<head>
<script type="text/javascript">
      function getValbyName(mummy, nm)
      {
            var rval = "";
            var kids = mummy.childNodes;
            for(var i=0; i<kids.length; i++)
            {
                  if(kids[i].nodeType == 1)
                  {
                        if(kids[i].name == nm)
                        {
                              rval = kids[i].value;
                              break;
                        }
                  }
            }
            return rval;
      }
</script>
</head>
<body>
        <applet name="panoviewer" code="panoapplet.jar" width="350" height="280" id=Applet1>
            <param name="alt" value=" "/>
            <param name="auto" value="70"/>
            <param name="view" value="360"/>
            <param name="zoomangle" value="30"/>
            <param name="background" value="0, 0, 0"/>
            <param name="toolbarstyle" value="floating"/>
            <param name="toolbar" value="disabled"/>
            <param name="file" value="/images/frontyard.jpg"/>
      </applet>
      <input type="button" value="test" onclick="alert(getValbyName(document.getElementById('Applet1'), 'file'));"
</body>
</html>
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now