jollyjoe wrote: ↑07 Jul 2023, 12:02Can I update an element without triggering it in the HTML?
Example:
I want this elementto turn into this: (automatically after the neutron page loads)Code: Select all
<div class="expiration" id="exp">INACTIVE</div>
using this:Code: Select all
<div class="expiration" id="exp">TEST</div>
This is what I've tried so far (to no avail)Code: Select all
neutron.doc.getElementById("exp").innerText := "test"
Any help would be greatly appreciated.Code: Select all
#Persistent #SingleInstance ignore ;some code to initially verify if my license is valid ;and store it into a var (license) mm := new NeutronWindow() mm.Load("html/home.html") mm.Gui("-Resize +LabelGui") mm.Show("w410 h483") settimer, Link, 1000 ;tried to make it update every 1s but nothing happens automatically return Link() { global neutron neutron.doc.getElementById("exp").innerText := license ;I want this to "happen" without the need for triggering it with html. }
I wanna add: I also dont want to trigger it via a hotkey. I just want it to run at the beggining of the script when the page first loads, Is this possible?
[Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids (now for v2!)
Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids (now for v2!)
Agreed. Is there a way to setValue?
Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids (now for v2!)
You can use JavaScript
Just like this
Code: Select all
js := "
( ; js
function ChangeElementInnerText() {
let test = document.getElementById('exp');
test.innerText='TEST';
};
)"
Clicked(neutron, event) {
; event.target will contain the HTML Element that fired the event.
; Show a message box with its inner text.
MsgBox "You clicked: " event.target.innerText
;Using AHK to execute JavaScript functions
neutron.wnd.execScript("ChangeElementInnerText()")
}
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 61 guests