Hallo,
ich erzeuge über ein get <name> ... eine HTML-Tabelle, in der ich Links in der Form:
<div id="button"><button id="alarm" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page alarm xhrId all&XHR=1')">alarm</button></div>
hinterlege.
Bei der Generierung des Ergebnisfensters wird durch fhemWeb aus dem Device-Namen 'FritzBox' ein:
<a href='/fhem?detail=FritzBox'>FritzBox</a>
Der oben gezeigte Link wird also zu:
<td><div id="button"><button id="alarm" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page alarm xhrId all&XHR=1')">alarm</button></div></td><td>xhr 1 lang de page alarm xhrId all</td></tr>
<tr>
Wird nun der Button angeklickt erhalte ich die Fehlermeldung:
fhem?detail=FritzBox line 1:
Uncaught SyntaxError: Unexpected string
Wie kann ich die Tabelle so aufbereiten, dass der Link funktioniert?
Danke und Grüße Jörg
ZitatWie kann ich die Tabelle so aufbereiten, dass der Link funktioniert?
Die Rueckgabe in <html>...</html> einbetten, dann passiert keine weitere Umwandlung.
Hallo Rudi,
hatte ich schon probiert. Funktioniert leider nicht.
Hier der Return-Wert des get:
<table border="8" cellspacing="20" cellpadding="20"><tr>
<td colspan="2">API Call: data.lua</td></tr>
<tr>
<td>Alias</td><td>Command</td>
</tr>
<tr>
<td><html><div id="button"><button id="alarm" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page alarm xhrId all&XHR=1')">alarm</button></div></html></td><td>xhr 1 lang de page alarm xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="callLock" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page callLock&XHR=1')">callLock</button></div></html></td><td>xhr 1 lang de page callLock</td></tr>
<tr>
<td><html><div id="button"><button id="chan" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page chan refresh nop&XHR=1')">chan</button></div></html></td><td>xhr 1 lang de page chan refresh nop</td></tr>
<tr>
<td><html><div id="button"><button id="dnsSrv" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page dnsSrv xhrId all&XHR=1')">dnsSrv</button></div></html></td><td>xhr 1 lang de page dnsSrv xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="docInfo" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page docInfo xhrId all no_sidrenew nop&XHR=1')">docInfo</button></div></html></td><td>xhr 1 lang de page docInfo xhrId all no_sidrenew nop</td></tr>
<tr>
<td><html><div id="button"><button id="dslOv" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page dslOv xhrId all&XHR=1')">dslOv</button></div></html></td><td>xhr 1 lang de page dslOv xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="energy" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page energy xhrId all&XHR=1')">energy</button></div></html></td><td>xhr 1 lang de page energy xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="environment" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page chan xhrId environment useajax 1&XHR=1')">environment</button></div></html></td><td>xhr 1 lang de page chan xhrId environment useajax 1</td></tr>
<tr>
<td><html><div id="button"><button id="kidPro" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page kidPro&XHR=1')">kidPro</button></div></html></td><td>xhr 1 lang de page kidPro</td></tr>
<tr>
<td><html><div id="button"><button id="led" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page led xhrId all&XHR=1')">led</button></div></html></td><td>xhr 1 lang de page led xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="log_filter" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page log xhrId log filter&XHR=1')">log_filter</button></div></html></td><td>xhr 1 lang de page log xhrId log filter</td></tr>
<tr>
<td><html><div id="button"><button id="log_filter_fon" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page log xhrId log filter fon&XHR=1')">log_filter_fon</button></div></html></td><td>xhr 1 lang de page log xhrId log filter fon</td></tr>
<tr>
<td><html><div id="button"><button id="log_filter_sys" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page log xhrId log filter sys&XHR=1')">log_filter_sys</button></div></html></td><td>xhr 1 lang de page log xhrId log filter sys</td></tr>
<tr>
<td><html><div id="button"><button id="mobile" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page mobile xhrId all&XHR=1')">mobile</button></div></html></td><td>xhr 1 lang de page mobile xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="netDev" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page netDev xhrId all&XHR=1')">netDev</button></div></html></td><td>xhr 1 lang de page netDev xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="netMoni" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page netMoni xhrId all&XHR=1')">netMoni</button></div></html></td><td>xhr 1 lang de page netMoni xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="netSet" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page netSet xhrId all&XHR=1')">netSet</button></div></html></td><td>xhr 1 lang de page netSet xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="save_energy" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page save_energy xhrId all&XHR=1')">save_energy</button></div></html></td><td>xhr 1 lang de page save_energy xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="sh_dev" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page sh_dev xhrid all&XHR=1')">sh_dev</button></div></html></td><td>xhr 1 lang de page sh_dev xhrid all</td></tr>
<tr>
<td><html><div id="button"><button id="sh_matter" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page sh_matter xhrId all&XHR=1')">sh_matter</button></div></html></td><td>xhr 1 lang de page sh_matter xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="shareVpn" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page shareVpn xhrId all&XHR=1')">shareVpn</button></div></html></td><td>xhr 1 lang de page shareVpn xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="shareWireguard" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page shareWireguard xhrId all&XHR=1')">shareWireguard</button></div></html></td><td>xhr 1 lang de page shareWireguard xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="trafapp" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page trafapp xhrId all&XHR=1')">trafapp</button></div></html></td><td>xhr 1 lang de page trafapp xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="usbOv" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page usbOv xhrId all&XHR=1')">usbOv</button></div></html></td><td>xhr 1 lang de page usbOv xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="wGuest" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page wGuest xhrId all&XHR=1')">wGuest</button></div></html></td><td>xhr 1 lang de page wGuest xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="wKey" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page wKey xhrId all&XHR=1')">wKey</button></div></html></td><td>xhr 1 lang de page wKey xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="wlanmesh" onclick="JS:FW_cmd(FW_root+'?cmd=get FritzBox luaData xhr 1 lang de page wlanmesh xhrId all&XHR=1')">wlanmesh</button></div></html></td><td>xhr 1 lang de page wlanmesh xhrId all</td></tr>
</table>
Und hier, was ich im Edge in den Entwicklungstools sehe:
<table border="8" cellspacing="20" cellpadding="20"><tr>
<td colspan="2">API Call: data.lua</td></tr>
<tr>
<td>Alias</td><td>Command</td>
</tr>
<tr>
<td><html><div id="button"><button id="alarm" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page alarm xhrId all&XHR=1')">alarm</button></div></html></td><td>xhr 1 lang de page alarm xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="callLock" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page callLock&XHR=1')">callLock</button></div></html></td><td>xhr 1 lang de page callLock</td></tr>
<tr>
<td><html><div id="button"><button id="chan" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page chan refresh nop&XHR=1')">chan</button></div></html></td><td>xhr 1 lang de page chan refresh nop</td></tr>
<tr>
<td><html><div id="button"><button id="dnsSrv" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page dnsSrv xhrId all&XHR=1')">dnsSrv</button></div></html></td><td>xhr 1 lang de page dnsSrv xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="docInfo" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page docInfo xhrId all no_sidrenew nop&XHR=1')">docInfo</button></div></html></td><td>xhr 1 lang de page docInfo xhrId all no_sidrenew nop</td></tr>
<tr>
<td><html><div id="button"><button id="dslOv" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page dslOv xhrId all&XHR=1')">dslOv</button></div></html></td><td>xhr 1 lang de page dslOv xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="energy" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page energy xhrId all&XHR=1')">energy</button></div></html></td><td>xhr 1 lang de page energy xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="environment" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page chan xhrId environment useajax 1&XHR=1')">environment</button></div></html></td><td>xhr 1 lang de page chan xhrId environment useajax 1</td></tr>
<tr>
<td><html><div id="button"><button id="kidPro" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page kidPro&XHR=1')">kidPro</button></div></html></td><td>xhr 1 lang de page kidPro</td></tr>
<tr>
<td><html><div id="button"><button id="led" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page led xhrId all&XHR=1')">led</button></div></html></td><td>xhr 1 lang de page led xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="log_filter" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page log xhrId log filter&XHR=1')">log_filter</button></div></html></td><td>xhr 1 lang de page log xhrId log filter</td></tr>
<tr>
<td><html><div id="button"><button id="log_filter_fon" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page log xhrId log filter fon&XHR=1')">log_filter_fon</button></div></html></td><td>xhr 1 lang de page log xhrId log filter fon</td></tr>
<tr>
<td><html><div id="button"><button id="log_filter_sys" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page log xhrId log filter sys&XHR=1')">log_filter_sys</button></div></html></td><td>xhr 1 lang de page log xhrId log filter sys</td></tr>
<tr>
<td><html><div id="button"><button id="mobile" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page mobile xhrId all&XHR=1')">mobile</button></div></html></td><td>xhr 1 lang de page mobile xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="netDev" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page netDev xhrId all&XHR=1')">netDev</button></div></html></td><td>xhr 1 lang de page netDev xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="netMoni" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page netMoni xhrId all&XHR=1')">netMoni</button></div></html></td><td>xhr 1 lang de page netMoni xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="netSet" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page netSet xhrId all&XHR=1')">netSet</button></div></html></td><td>xhr 1 lang de page netSet xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="save_energy" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page save_energy xhrId all&XHR=1')">save_energy</button></div></html></td><td>xhr 1 lang de page save_energy xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="sh_dev" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page sh_dev xhrid all&XHR=1')">sh_dev</button></div></html></td><td>xhr 1 lang de page sh_dev xhrid all</td></tr>
<tr>
<td><html><div id="button"><button id="sh_matter" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page sh_matter xhrId all&XHR=1')">sh_matter</button></div></html></td><td>xhr 1 lang de page sh_matter xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="shareVpn" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page shareVpn xhrId all&XHR=1')">shareVpn</button></div></html></td><td>xhr 1 lang de page shareVpn xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="shareWireguard" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page shareWireguard xhrId all&XHR=1')">shareWireguard</button></div></html></td><td>xhr 1 lang de page shareWireguard xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="trafapp" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page trafapp xhrId all&XHR=1')">trafapp</button></div></html></td><td>xhr 1 lang de page trafapp xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="usbOv" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page usbOv xhrId all&XHR=1')">usbOv</button></div></html></td><td>xhr 1 lang de page usbOv xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="wGuest" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page wGuest xhrId all&XHR=1')">wGuest</button></div></html></td><td>xhr 1 lang de page wGuest xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="wKey" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page wKey xhrId all&XHR=1')">wKey</button></div></html></td><td>xhr 1 lang de page wKey xhrId all</td></tr>
<tr>
<td><html><div id="button"><button id="wlanmesh" onclick="JS:FW_cmd(FW_root+'?cmd=get <a href='/fhem?detail=FritzBox'>FritzBox</a> luaData xhr 1 lang de page wlanmesh xhrId all&XHR=1')">wlanmesh</button></div></html></td><td>xhr 1 lang de page wlanmesh xhrId all</td></tr>
</table>
PS: die ganze Tabelle mit <html>...</html> zu klammern hilft leider auch nicht
Grüße Jörg
ZitatPS: die ganze Tabelle mit <html>...</html> zu klammern hilft leider auch nicht
Stimmt, mein Vorschlag funktioniert nicht fuer die Rueckgabe von get/set/etc.
Habs eingebaut und eingecheckt.
Hallo Rudi,
vielen Dank und macht was es soll.
Grüße Jörg