本文整理汇总了Python中pyjamas.DOM.getElementById方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.getElementById方法的具体用法?Python DOM.getElementById怎么用?Python DOM.getElementById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.getElementById方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onreadystatechange
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def onreadystatechange():
if xhtoj.readyState == 4:
jsnode = 0
if xhtoj.status == 200:
txt = xhtoj.responseText
jsnode = None
if idname:
jsnode = DOM.getElementById(idname)
if jsnode is None:
jsnode = DOM.createElement('script')
#tst = DOM.createElement('html')
#tst.innerHTML = str
activate_javascript(txt)
if not on_load_fn is None:
wnd().alert(on_load_fn)
# eval(on_load_fn)
test_fn()
return 1
else:
jsnode = DOM.getElementById(idname)
if not jsnode is None:
jsnode.innerHTML = xhtoj.status
示例2: validarParametrosMatriz
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def validarParametrosMatriz():
lm1 = DOM.getElementById("lm1")
lm1 = lm1.value
cm1 = DOM.getElementById("cm1")
cm1 = cm1.value
lm2 = DOM.getElementById("lm2")
lm2 = lm2.value
cm2 = DOM.getElementById("cm2")
cm2 = cm2.value
if not lm1 or not lm2:
Window.alert("Informe o numero de linhas da matriz M1 e M2.")
return False
if lm1 != lm2:
Window.alert("A quantidade de linhas da matriz M1 deve ser igual a da matriz M2 para operação de soma.")
return False
if lm1 > "5" or lm2 > "5" or len(lm1) != 1 or len(lm2) != 1:
Window.alert("A quantidade de linhas da matriz M1 e da matriz M2, deve ser menor ou igual a 5.")
return False
if not cm1 or not cm2:
Window.alert("Informe o numero de colunas da matriz M1 e M2.")
return False
if cm1 != cm2:
Window.alert("A quantidade de colunas da matriz M1 deve ser igual a da matriz M2 para operação de soma.")
return False
if cm1 > "7" or cm2 > "7" or len(cm1) != 1 or len(cm2) != 1:
Window.alert("A quantidade de colunas da matriz M1 e da matriz M2, deve ser menor ou igual a 7.")
return False
return True
示例3: validarParametrosTestarSolucao
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def validarParametrosTestarSolucao():
lm1 = DOM.getElementById("linha1")
lm1 = lm1.value
cm1 = DOM.getElementById("coluna1")
cm1 = cm1.value
lm2 = DOM.getElementById("linha2")
lm2 = lm2.value
cm2 = DOM.getElementById("coluna2")
cm2 = cm2.value
示例4: onCompletion
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def onCompletion(self, responseText):
# TODO - cope with unicode / utf-8 test results
print "onCompletion", self.unittest.tests_outstanding, self.test_name
self.unittest.async_test_name = self.test_name
e1 = DOM.getElementById('testcompare1')
e2 = DOM.getElementById('testcompare2')
e1.innerHTML = responseText
e2.innerHTML = responseText
i1 = DOM.walkChildren(e1)
i2 = DOM.walkChildren(e2)
ok = True
while ok:
try:
ec1 = i1.next()
ec2 = i2.next()
except StopIteration:
break
ok = ok and (ec1.nodeType == ec2.nodeType)
if not ok:
break
print ec1.nodeName, ec1.nodeValue
ok = ok and (ec1.nodeName == ec2.nodeName)
ok = ok and (ec1.nodeValue == ec2.nodeValue)
if not ok:
break
if hasattr(ec1, 'getInnerText') and hasattr(ec2, 'getInnerText'):
print ec1.getInnerText()
ok = ok and (ec1.getInnerText() == ec2.getInnerText())
if not ok:
break
if hasattr(ec1, 'attributes') and hasattr(ec2, 'attributes'):
a1 = ec1.attributes
a2 = ec2.attributes
ok = hasattr(a1, 'length') and hasattr(a2, 'length')
if not ok:
break
ok = ok and (a1.length == a2.length)
if not ok:
break
for i in range(a1.length):
ai1 = a1.item(i)
ai2 = a2.item(i)
ok = ok and (ai1.nodeValue == ai2.nodeValue)
ok = ok and (ai1.nodeName == ai2.nodeName)
self.unittest.assertTrue(ok)
self.unittest.tests_outstanding -= 1
# clear the test HTML
e1.innerHTML = ''
e2.innerHTML = ''
示例5: write_test_output
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def write_test_output(self, name=None, div_id=None):
if div_id is None:
div_id = 'tests'
element = DOM.getElementById(div_id)
output = element.innerHTML
if self.test_gen_folder is None:
if self.tests_outstanding is None:
self.tests_outstanding = 0
self.tests_outstanding += 1
self.do_test(output, name)
return
# otherwise assume we're running pyjd, and have file-system
# access
import os
if name:
fname = "%s.%s.txt" % (self.current_test_name, name)
else:
fname = "%s.txt" % self.current_test_name
f = open(os.path.join(self.test_gen_folder, fname), "w")
f.write(output)
f.close()
if self.tests_outstanding is None:
self.tests_outstanding = 0
return False
示例6: onModuleLoad
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def onModuleLoad(self):
self.remote = DataService()
vPanel = VerticalPanel()
# create div to hold map
mapPanel = SimplePanel()
mapPanel.setSize('700px','400px')
# initiate getting gps data from web2py
self.remote.getPoints(self)
# create slider div
slider = SimplePanel()
self.slider = slider
# add map and slide to main panel
vPanel.add(mapPanel)
vPanel.add(slider)
# add everything to page's GreedyPyJs div
root = RootPanelCls(DOM.getElementById("GreedPyJs"))
root.add(vPanel)
# Create initial google map
self.map = GMap2(mapPanel.getElement())
self.map.setCenter(GLatLng(37.4419, -122.1419), 13)
# create place to hold gps positions
# these will be in tuples: (date, latitude, longitude)
self.positions=[]
示例7: testDivHTML
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def testDivHTML(self):
e = DOM.getElementById('tests')
div = DOM.createElement('div')
DOM.appendChild(e, div)
DOM.setInnerHTML(div, 'hello world\n')
self.write_test_output('addDiv')
DOM.removeChild(e, div)
self.write_test_output('removeDiv')
示例8: get
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def get(id=None):
"""
"""
if rootPanels.has_key(id):
return rootPanels[id]
element = None
if id:
element = DOM.getElementById(id)
if not element:
return None
return manageRootPanel(RootPanelCls(element), id)
示例9: inicia
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def inicia(self):
global IMAGEREPO
self.__form = f = DOM.getElementById('mainform')
self.x = DOM.getChild(f,0).value #DOM.getElementByName('_xsrf').value
g = DOM.getChild(f,1).value
self.scored = DOM.getChild(f,2)
self.housed = DOM.getChild(f,3)
if g == '12de6b622cbfe4d8f5c8d3347e56ae8c': IMAGEREPO = 'imagens/'
#self.talk(self.scored.value+self.housed.value+IMAGEREPO)
self._socket = NullSocket() #WebSocket("ws://%s/chatsocket"%self.test())
self._socket.register_receiver(self.game.receive)
obj = j_p.wdecode(self.housed.value)
#self.text(400,85, str(obj) ,'darkbrown',10)
#obj = [dict(body='nonono')]
return obj
示例10: get
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def get(cls, id=None):
"""
"""
if rootPanels.has_key(id):
return rootPanels[id]
element = None
if id:
element = DOM.getElementById(id)
if not element:
return None
if len(rootPanels) < 1:
cls.hookWindowClosing()
panel = RootPanel(element)
rootPanels[id] = panel
return panel
示例11: getMovieElement
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def getMovieElement(self):
"""
@return: element DOM-Object of the object-tag
"""
element = DOM.getElementById(self.object_id)
return element
示例12: validarParametrosTestarSolucao
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getElementById [as 别名]
def validarParametrosTestarSolucao():
lm1 = DOM.getElementById("linha1");
lm1 = lm1.value
cm1 = DOM.getElementById("coluna1");
cm1 = cm1.value