PDA

View Full Version : javascript problem



bmn
22nd August 2009, 20:05
hi qtlers!:D:p

im trying to login with the webview control into this site: http://www.team-ulm.de (german language but it doesnt matter;))
i need to fill out the "Login" field on the left side.

I tryed that:

ui->webView->page()->mainFrame()->evaluateJavaScript("document.getElementById('benutzer').innerText = \"hi\";");

nothing happens. but when i try


ui->webView->page()->mainFrame()->evaluateJavaScript("alert(\"hi\")");

it works. but it isnt what i want^^

im working in windows.

i hope someone can help me..

ouned

ps: in visual studio it works like that:


webBrowser1.Document.GetElementById("benutzer").InnerText = "hi";

AcerExtensa
24th August 2009, 14:40
<input class="chatfields" type="text" name="benutzer" style="width:78px;" tabindex="1" />

getElementById need id property of HTML tag, like
<div id="benutzer"></div>
and you have name prop.
name = "benutzer". Try to use getElementByName instead....