Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Show all P element certain width and centered
Message
From
13/04/2018 16:13:55
 
General information
Forum:
HTML5
Category:
Browser issues
Miscellaneous
Thread ID:
01659394
Message ID:
01659400
Views:
45
this is another way to solve your problem dynamically.
*this code can modify dynamically a web page.here all "P" tagnames are modified by code.it uses the method getElementByTagname (who returns 
*a collection of all web page object having "P" tag.

PUBLIC oform
oform=NEWOBJECT("form1")
oform.Show
RETURN

DEFINE CLASS form1 AS form
	Height = 633
	Width = 882
	AutoCenter = .T.
	Caption = "Form1"
	windowstate=2
	Name = "form1"

	ADD OBJECT olecontrol1 AS olecontrol WITH ;
	    oleclass="Shell.explorer.2",;
		Top = 0, ;
		Left = 0, ;
		Height = 588, ;
		Width = 888, ;
		Anchor = 15, ;
		Name = "Olecontrol1"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 600, ;
		Left = 342, ;
		Height = 27, ;
		Width = 210, ;
		Anchor = 768, ;
		fontbold=.t. , ;
		Caption = "tweak P Tagsname dynamically", ;
		Name = "Command1"

	PROCEDURE olecontrol1.Init
		THIS.silent=.t.
		this.navigate("www.atoutfox.org")
	ENDPROC

	PROCEDURE command1.Click
		x= thisform.olecontrol1.document.getElementsByTagName("p")  &&Get all elements in the document with the specified tag name (its a collection of objects)
		messagebox("p tagname count="+trans(m.x.length))

		for each obj in m.x  &&pput all styles you want here for all p tags
		obj.style.textAlign="center"
		obj.style.width="700px"
		obj.style.color="rgb(255,0,0)"
		obj.style.fontsize="20px"
                obj.style.fontFamily="courier new" 
                obj.style.fontstyle="italic"
                obj.style.backgroundColor = "cyan"
		obj.style.borderRadius = "25px"
		next
	ENDPROC

ENDDEFINE
*
*-- EndDefine: form1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform