有没有办法使用 HTML 导航到另一个表单?
例如,我的内部HTML旁边的链接
<a href="goto form 2 here">Form2</a>
它只是我硬编码到TW3ScrollControl的innerHTML属性中的HTML。有些HTML是静态的,有些是我从JSON文件中获取的动态数据(例如问题和答案(
例如
Who is the president of the United States?
Hillary Clinton
Bernie Sanders
Joseph Biden
Donald Trump
那么,在我的头顶上给出这样的东西,如果点击其中一个名称,将如何执行 GotoForm?
<div>
<p>Who is the president of the United States?</p>
<br>
<center>
<A href=""> Hillary Clinton </A><br>
<A href=""> Bernie Sanders </A<br>
<A href=""> Joseph Biden </A<br>
<A href=""> Donald Trump </A<br>
</center>
</div>
感谢
在Facebook朋友:)的帮助下我能够提出以下内容
var i: integer;
IdStr: String;
begin
fQuestion.content.InnerHTML:= '<div style="text-align: center; position: relative;">' +
'<br><center><p>' + fQuestions.questions[fIndex].question + '</p></center><br>' +
'<center>' +
'<A id="answer1" href="">' + fQuestions.questions[fIndex].answers[0] + '</A><br>' +
'<A id="answer2" href="">' + fQuestions.questions[fIndex].answers[1] + '</A><br>' +
'<A id="answer3" href="">' + fQuestions.questions[fIndex].answers[2] + '</A><br>' +
'<A id="answer4" href="">' + fQuestions.questions[fIndex].answers[3] + '</A><br>' +
'</center>' +
'</div>';
for i:= 1 to 4 do
begin
IdStr:= 'answer' + intToStr(i);
var h:= BrowserAPI.Document.getElementById(idStr);
if (h) then
begin
h.onclick := procedure (ev: variant)
begin
//do something here
end;
end;
end;
end;