Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QBJS - HTML integration
#1
Thumbs Up 
Greetings

I'm struggling to work out how to add option select form
Elements in qbasic using the. Dom.Bas library. 

 I need individual selectable answers 

I'm trying to achieve following 

Print "Example question 1"  (show html select options)  store ans
Print "Example question 2" (show select options) store ans

Basically my questions should show selectable options

Many thanks
Reply
#2
(11-16-2023, 05:37 PM)misproductions Wrote: I'm struggling to work out how to add option select form
Elements in qbasic using the. Dom.Bas library. 

I'm trying to achieve following 

Print "Example question 1"  (show html select options)  store ans
Print "Example question 2" (show select options) store ans

Many thanks
Here is an example of creating a simple html form with options.  Let me know if this is what you were looking for:

Reply
#3
Is Dom.bas a qbjs thing?

Quote:I'm struggling to work out how to add option select form
Elements in qbasic using the. Dom.Bas library.

Nice demo dbox! Be nice to do that with my GUI too.
Looks to me like dom.bas is not from qbasic.
b = b + ...
Reply
#4
(11-16-2023, 09:30 PM)bplus Wrote: Nice demo dbox! Be nice to do that with my GUI too.
Looks to me like dom.bas is not from qbasic.
That's correct @bplus.  The Dom library is an extension that is only available in QBJS.
Reply
#5
(11-16-2023, 06:33 PM)dbox Wrote:
(11-16-2023, 05:37 PM)misproductions Wrote: I'm struggling to work out how to add option select form
Elements in qbasic using the. Dom.Bas library. 

I'm trying to achieve following 

Print "Example question 1"  (show html select options)  store ans
Print "Example question 2" (show select options) store ans

Many thanks
Here is an example of creating a simple html form with options.  Let me know if this is what you were looking for:

Brilliant ! I envy your knowledge Smile  -

hey is there a way you can hide and show certain dom elements (i know in js and jquery using hide show etc) ?

also how would I implement the onChange event for each question so that i can print
a message based on the selected answer 

many thanks!
Reply
#6
(11-17-2023, 03:28 PM)misproductions Wrote: hey is there a way you can hide and show certain dom elements (i know in js and jquery using hide show etc) ?

also how would I implement the onChange event for each question so that i can print
a message based on the selected answer 

Hey @misproductions, I've updated the sample to show you how to show and hide the dom elements.  I've also added a change event to the favorite color option list.

Generally speaking, any dom element object that is set from either the Dom.Create or Dom.Get methods has all of the style properties that can be set in Javascript.  And there are a lot now!  Here's a handy reference:
https://www.w3schools.com/jsref/dom_obj_style.asp

Similarly, you can create event handler methods for every type of event (that the element supports) with the Dom.Event method.  Here's a reference of all the available events:
https://www.w3schools.com/jsref/dom_obj_event.asp


Reply




Users browsing this thread: 1 Guest(s)