Source language: Translate to:

Fill web forms with JScript and innerHTML

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Fill web forms with JScript and innerHTML

Postby Siegmar » Wed Nov 10, 2010 4:42 am

Hello,
I am working on a tool for an editor. The idea is to enable the editor to simply click a publish button and the article will be published on the internet.
First I thought about to create a simple HTML based FileWrite / FileRead system.
But then I played with BrowserSetElement and of course its much better to use the functions of the CMS.
So, the editor will click the publish button and neobook will log into the cms-backend and publish it.

Login works fine. But then on the article creation site BrowserSetElement doesnt find the IDs for Title, Subtitle, Content and so on.
I learned now that I have to use innerHTML and JScript. Unfortunally I dont know nothing about it.

What I tried is this:

Code: Select all
BrowserExecScript "WebBrowser1" "document.getElementByID([#34]contentelement[#34]).innerHTML='id=[#34]Title[#34]'" "JScript""


But the ID still isnt found - and if its found - will BrowserSetElement work then? I doubt ...

Someone can help?
Thank you!
[/code]
User avatar
Siegmar
 
Posts: 23
Joined: Tue Sep 12, 2006 11:19 am
Location: Duisburg, Germany

Postby virger » Wed Nov 10, 2010 8:47 am

ESTO PODRIA AYUDAR

1.CREAR UN WEB EN NB
--------------------------------

2.PONER ESTE HTML
------------------------------
<html>
<body>
<div id="TheIdElement">
Estas son las cosas raras
</div>
</body>
</html>

3.CREAR ESTAS VARIABLES EN EL BOTON EXECUTE
--------------------------------------------------------------------------
setvar "[NewText]" "HOLA A TODOS"
setvar "[InnerId]" "TheInnerId"

4.ESTA ES LA ACCION DEL BOTON EXECUTE
---------------------------------------------------------------
BrowserExecScript "WEB" "var TheText = [#34][NewText][#34];|var TheIdElement = [#34][InnerId][#34];|document.getElementById(TheIdElement).innerHTML = TheText ;" "JScript"


PURA VIDA DESDE COSTA RICA
"LA ISLA CALERO ES DE COSTA RICA"
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Postby Neosoft Support » Wed Nov 10, 2010 11:14 am

It may be that your HTML document is too complex. Try simplifying it and see if that makes any difference.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Siegmar » Thu Nov 11, 2010 6:04 am

Muchas gracias, virger. Your code is great

@neosoft support
Thanks, it is not my html code - its the html code by the cms. Nevertheless I choosed a less complex content part - and yes!!! this solved my problem.
User avatar
Siegmar
 
Posts: 23
Joined: Tue Sep 12, 2006 11:19 am
Location: Duisburg, Germany


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest