getElementsByClassName() <> innerText <> innerHTML

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: getElementsByClassName() <> innerText <> innerHTML

Re: getElementsByClassName() <> innerText <> innerHTML

Post by effel » 01 Aug 2023, 09:09

ich habe die Lösung, danke fürs lesen
boiler wrote:
12 Nov 2019, 08:08
3ggg wrote: 2nd question, if I want the link i just replace .innerText with .href right?
Yes, generally that will give you the link URL if there is one associated with it.

getElementsByClassName() <> innerText <> innerHTML

Post by effel » 31 Jul 2023, 13:31

Guten Abend,

ich versuche mit meinem Code einen Link zu erreichen, bekomme jedoch nur alle angezeigt.

Wie ich mit anderen Bordmitteln wie [loop, parse] daran komme weiss ich, mir stellt sich nur die Frage ob es auch durch abändern von res#Test[a_index-1].innerHTML möglich ist einzelne Links aus dem HTML Code zu saugen.



Code: Select all

; #STARTinnerTextTHREAD_14
Automatically changes "am" to "AM" (w/ font size) 

Last post by BannerStore « Yesterday, 16:50 

by BannerStore » Yesterday, 16:50 
; #ENDinnerTextTHREAD_14

; #STARTinnerHTMLTHREAD_14


						
						<a class="topictitle" href="./viewtopic.php?f=6&amp;t=119924">Automatically changes "am" to "AM" (w/ font size)</a>

						
						
						<br>



						


						
						<div class="responsive-show" style="display: none;">

							Last post by <a class="username" href="./memberlist.php?mode=viewprofile&amp;u=81634">BannerStore</a> « <a title="Go to last post" href="./viewtopic.php?f=6&amp;t=119924&amp;p=532104#p532104">Yesterday, 16:50</a>

							
						</div>

						
						


						


						<div class="responsive-hide">

							
							
							by <a class="username" href="./memberlist.php?mode=viewprofile&amp;u=81634">BannerStore</a> » Yesterday, 16:50

							
						</div>



						
					
; #ENDinnerHTMLTHREAD_14

Code: Select all


url := "https://www.autohotkey.com/boards/viewforum.php?f=6"

#Warn ,,Off
#NoEnv
urlDownLoadToFile,% url,% a_scriptDir "\" anow " tmp.txt.html" 
fileRead, thisHTML,% a_scriptDir "\" anow " tmp.txt.html"
fileDelete,% a_scriptDir "\" anow " tmp.txt.html"

Doc := DocumentFromHTML(thisHTML)

testSuche = topiclist topics
testSuche = pagination
;testsuche = next
testSuche = list-inner
;testsuche = topictitle

 res#test 	:= doc.getElementsByClassName(testSuche)
res#TestLength := res#Test.length

loop, % (res#TestLength ? res#TestLength : 100)
{
try #Test 	.= 	(res#Test[a_index-1].innerText) 
		? ("`; #STARTinnerTextTHREAD_" a_index "`n" res#Test[a_index-1].innerText  "`n`; #ENDinnerTextTHREAD_" a_index "`n")  
		: "`; #STARTinnerTextTHREAD_" a_index "`n`; #emptyinnerText`n`;#ENDinnerTextTHREAD_" a_index "`n"
}


loop, % (res#TestLength ? res#TestLength : 100) 
{
try #Test 	.= 	(res#Test[a_index-1].innerHTML) 
		? ("`; #STARTinnerHTMLTHREAD_" a_index "`n" res#Test[a_index-1].innerHTML "`n`; #ENDinnerHTMLTHREAD_" a_index "`n")  
		: "`; #STARTinnerHTMLTHREAD_" a_index "`n`; #emptyINNERHTML`n`;#ENDinnerHTMLTHREAD_" a_index "`n"
}

msgBox % #Test

Top