Write content in the document. #2171
Answered
by
PierreQuentel
BobSquarePants
asked this question in
Q&A
Replies: 4 comments 3 replies
-
from browser import document, html, window
# 1. create a JS script from source code
js = """
window.new_func = function(){
alert('hello !')
}
"""
document <= html.SCRIPT(js)
window.new_func()
# 2. load an existing JS script by its url
script = html.SCRIPT(src='jsobj_tests.js')
def load(ev):
print(window.Rectangle)
script.bind('load', load)
document <= script |
Beta Was this translation helpful? Give feedback.
1 reply
-
from browser import document, html
document <= html.B('bold text') |
Beta Was this translation helpful? Give feedback.
1 reply
-
document.html += '<b>bold text</b>'
document.html += '<br><i>italic</i>' |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
BobSquarePants
-
Hi, How we do the same but for the I've tried document.head += '<link rel="stylesheet" type="text/css" href="some.css">' but this is not working.. any ideas ? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I would like after my Brython script has been loaded and executed, to load a .JS file :/
(Yeah during this transition time we still need them ..)
So I was thinking to use something like
But of course this is not working :'(
Any ideas ?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions