Source language: Translate to:

Getting a list of web browser elements

Questions and information about creating Internet aware NeoBook applications. Including PHP, HTML, FTP, HTTP, Email, etc.

Moderator: Neosoft Support

Getting a list of web browser elements

Postby andybrock » Sat Jun 05, 2010 10:19 am

Neobook has a getbrowserelement and setbrowserelement command which is great if you know the names of the elements. Is there any way to load a page and then get a list of all the elements on that web page which can be got or set by the get and set commands?

User avatar
Posts: 181
Joined: Mon Apr 20, 2009 1:38 pm
Location: Somerset, UK

Postby Gaev » Sat Jun 05, 2010 3:58 pm


The BrowserGetElement command needs the name of the element whose content you want copied to a [variable].

But elements do not need to be named in order to be rendered by a Browser ... as a result most elements in a typical HTML document are NOT named.

Elements in an HTML document have a hierarchial (parent-children) relationship ... and there are Javascript/DHTML commands to traverse this inverted-tree structure ... while you can ask NeoBook (via the BrowserExecScript command) to execute such commands, you need a good understanding of this structure and the Javascript/DHTML commands in order to do anything beneficial with it.
User avatar
Posts: 3749
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby bunker » Sat Jun 05, 2010 10:30 pm

Hi I made a simple html example:

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Test</title>
<script language="JavaScript">

function GetElements()
   for(i=0; i<document.test_form.elements.length; i++)
      alert("Type: " + document.test_form.elements[i].type + " Name: " + document.test_form.elements[i].name);

<form name="test_form" id="test_form" action="#">

Name: <input type="text" name="name" id="txt_name">

Email: <input type="text" name="email" id="txt_email">

<input type="button" name="submit" value="Submit">

<a href="javascript:GetElements()">Get elements</a>

You can modify the javascript so that you return the items in a vector in NeoBook ...

User avatar
Posts: 141
Joined: Sat Sep 29, 2007 4:00 pm

Postby andybrock » Sun Jun 06, 2010 12:51 am

Thank you, that's awesome.

User avatar
Posts: 181
Joined: Mon Apr 20, 2009 1:38 pm
Location: Somerset, UK

Return to NeoBook and the Internet

Who is online

Users browsing this forum: No registered users and 1 guest