1

is there a way to navigate to another form using HTML ?

for example, a link in side my innerHTML

<a href="goto form 2 here">Form2</a>

it is just HTML i was hardcoding into the innerHTML property of a TW3ScrollControl. Some of the HTML is static, some is dynamic data (e.g. question & answer) I get from my JSON file

for example

Who is  the president of the United States?


     Hillary Clinton
     Bernie Sanders
     Joseph Biden
     Donald Trump

so, giving something like this off the top of my head, how would on do a GotoForm if one of these names were clicked?

<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>

thanx

JakeSays
  • 2,048
  • 8
  • 29
  • 43

1 Answers1

1

with a little help from facebook friend :) I was able to come up with the following

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;
JakeSays
  • 2,048
  • 8
  • 29
  • 43