4

I have included Object/Embed in HTML-file of application to display another web page. i.e.

<!DOCTYPE HTML>

<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>PhoneGap</title>
<link rel="stylesheet" href="master.css" type="text/css">
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
<script type="text/javascript" charset="utf-8" src="main.js"></script>
</head>
<body onload="init();">
    <!-- <embed id='embadedContent' height = 400 width= '100%' src="http://192.168.2.44:9191/testtwo/"/> -->
    <object height = 400 width= '100%' data="http://192.168.2.44:9191/testtwo/">
        <param name="quality" value="high">
    </object>
</body>
</html>

Now, I want to get reference of components which are in Webpage (http://192.168.2.44:9191/testtwo/) like button, textfield, etc. so that based on logic I can change property of these elements.

Ali Sheikhpour
  • 10,475
  • 5
  • 41
  • 82
Nish
  • 1
  • 1
  • 4
  • 14
  • if you are loading webpage consider using iframe and use this to get elements document.getElementById('myframe').contentWindow.document – Azmat Karim Khan Nov 23 '15 at 11:53
  • @CodeiSir: I think that was just meant to show what the URL of his page was (which turns out to be relevant). – T.J. Crowder Nov 23 '15 at 11:54
  • Possible duplicate of [Read data in HTML object tag](https://stackoverflow.com/questions/36659202/read-data-in-html-object-tag) – Ali Sheikhpour Nov 11 '19 at 09:34

1 Answers1

0

Use the id tag to later refere to the element, e.g. like this: id="myObject1"

<object id="myObject1" height = 400 width= '100%' data="http://192.168.2.44:9191/testtwo/">
 <param name="quality" value="high">
</object>

And then you can access it via JavaScript:

var myObject1 = document.getElementById("myObject1")
myObject1.style.height = "200px"
CoderPi
  • 12,985
  • 4
  • 34
  • 62