Jump to content

Search the Community

Showing results for tags 'javascript calling a function'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 2 results

  1. Hello I have an issue when I trigger an event that call a function using onClientBrowserDocumentReady, i don't know what is the issue... This is my code: The issue is... onClientBrowserDocumentReady doesn't found the browser and it can't in into the event. the executeBrowserJavascript doesn't work event = {add = addEventHandler, load = addEvent, execute = triggerServerEvent} local WINDOW_WIDTH, WINDOW_HEIGHT = guiGetScreenSize() local CEF = nil local browser = nil function deleteWebPage() if isElement(CEF) then destroyElement(CEF) showCursor(false) end end function createWebPage() page = "http://mta/player/html/login.html" CEF = guiCreateBrowser(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, true, false, false) browser = guiGetBrowser(CEF) addEventHandler("onClientBrowserCreated", browser, function() loadBrowserURL(source, page) showCursor(true) end) end function sendErrorLabel(error) addEventHandler("onClientBrowserDocumentReady", browser, function() executeBrowserJavascript(browser, "document.querySelector('.error:nth-child(5)').innerHTML = '" .. error .. "'"); executeBrowserJavascript(browser, "document.querySelector('.error:nth-child(5)').style = 'display: initial; top: 90%; left:40.5%'"); end) end event.load('login-data:send', true) event.add('login-data:send', root, function(user, password) event.execute('login-menu:execute', resourceRoot, user, password) end, true) event.load("onClientPlayerLogout", true) event.add("onClientPlayerLogout", root, function() createWebPage() end) event.load("show-label:error", true) event.add("show-label:error", root, function(error) sendErrorLabel(error) end) event.load('login-menu:remove', true) event.add('login-menu:remove', root, function() deleteWebPage() end) event.add("onClientResourceStart", resourceRoot, function() createWebPage() end)
  2. Hello, I'm having some problems with this functions as I'm not familiar with javascript, I'm working with a HTML login which is almost done except for one thing, the user data saving. I've seen some "examples" about the use of javascript in login panels and follow the examples didn't work in any way. I just want to load the username and password from some xml and then autofilling them on the login panel, like this: This is what I tried: HTML <form action="javascript:loginTrigger()" method="post"> <input id="UsernameInput" type="text" class="username" placeholder="Username"> <input id="PasswordInput" type="password" class="password" placeholder="Password"> <button type="submit" class="log_button">Login</button> <div class="error"><span style="color:#999">+</span></div> </form> LUA username = magicalFunctionThatLoadTheUsername() password = magicalFunctionThatLoadThePassword() executeBrowserJavascript(theBrowser, 'document.getElementById("UsernameInput").val = "'..username..'";') executeBrowserJavascript(theBrowser, 'document.getElementById("PasswordInput").val = "'..password..'";') I'm not experienced with javascript (as you can obviously see) but I don't really get why it does not work as I'm follow the same steps as other examples I've seen around the web.
×
×
  • Create New...