rouzbeh_TopGTA Posted October 7, 2016 Share Posted October 7, 2016 (edited) Hi, i have problems with executeBrowserJavascript() im working on a html login panel working with java script, and i want create a rememberme checkbox... index.html: <form action="javascript:loginTrigger()" method="post"> <input id="UserLogin" type="text" name="u" placeholder="Username" required="required" /> <input id="PasswordLogin" type="password" name="p" placeholder="Password" required="required" /> <input id="rememberme" type="checkbox" /><img class="remember" src="files/remember.png" /> <button type="submit" class="btn btn-primary btn-block btn-large">Login</button> </form> client: initBrowser = guiCreateBrowser(0, 0, screenWidth, screenHeight, true, true, false) theBrowser = guiGetBrowser(initBrowser) executeBrowserJavascript ( theBrowser, "document.getElementById('rememberme').checked = true ;" ) this should check my checkbox if player using rememberme option, but executeBrowserJavascript not work! whats the problem? other lines is okay! just executeBrowserJavascript not work! Edited October 7, 2016 by rouzbeh_TopGTA Link to comment
Jusonex Posted October 7, 2016 Share Posted October 7, 2016 You have to wait for the HTML document (DOM) to be loaded. This can be archieved by using the onClientBrowserDocumentReady event. initBrowser = guiCreateBrowser(0, 0, screenWidth, screenHeight, true, true, false) theBrowser = guiGetBrowser(initBrowser) addEventHandler("onClientBrowserDocumentReady", theBrowser, function() executeBrowserJavascript ( theBrowser, "document.getElementById('rememberme').checked = true ;" ) end ) 1 Link to comment
rouzbeh_TopGTA Posted October 7, 2016 Author Share Posted October 7, 2016 Very Big Thanks, You solved my problem! i like u Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now