0
if(buttonA is pressed != button b is pressed) doo....?
Hi how the titel may tell you i want sth that can do: if(buttonA is pressed != button b is pressed) doo....? till know i have this: https://code.sololearn.com/WS8L15d5G63b but idont know why my pressed function is not working if(sP!=mP){ for(x=0;x<moduls.length; x++){ el.removeChild(el.lastChild)} click =0; } else{} cause if i click on "1 Semester" the sP should be 1 and the mP 0 hope someone can help me
16 odpowiedzi
+ 1
See here, read ALL comments and ask if you needed
https://code.sololearn.com/WdLNtzaRJ87h/#js
P.S. This is not the best way to do, but its useful forr your undestanding
+ 2
Thank you 😊
+ 2
jack Its used for indicate if #demo have children inserted in it (see the condition in a function). I writed than its possible do without it also because, inside a function, you can test if #demo have children with
if( el.children.length > 0)
Where el is #demo and if it have childs, it mean that current click must REMOVE all while if it have not child it meant ADD all childs
Anyway, i come from Italy
+ 1
jack i didnt understood the problem.... Can you explain better?
+ 1
jack Then reviewing:
On clicking #demo you add modul items inside it almost like a list.
After this, of you click on an item what must happen? In your code seem that you want load an iframe (remember iframe and not ifram 😉) by changing on click the src (here also, src and not scr 😉😉) attribute...Then, you want that on clicking #demo (after it have moduls) all moduls would be removed while on modul click, iframe loading would happen?
P.S. Why you used mouseup and mousedown listeners? What they would do?
+ 1
THANKS A LOT! !! so much help realy good explained I'll read later the hole document when I have more time.
Thanks for helping me sooo well
+ 1
didn't get why it is out of security reasons saver to hide the ofram
+ 1
great attitude man
+ 1
hey Krow I didnt get what you ment with this last sentence:
This var will be used for detect if moduls are added
to #demo (you can dont use it also but i added it
just for your understanding)
*/
and by the way where you from ;-)
0
sure I want in this example : when I click on semester it will open the Moduls and now I want If I click on modul that just the click event of modul get triggert and not from the div of semester
0
there is the div id=demo with the paragraph "1.semester" if you click on it the div will get children with the paragraph "modul 1" "Modul 2" ...
now I want that if I click on the div "1 Semester" that the children get removed but not if I click on modul.
because the modul is inside the dive "1 Semester" it removes the modules than I click on modul
0
hope that helped you
0
yes you got it:) I used mouse up and down to know when it's been clicked just on #demo and when also on modul and too add functions in the moment the click ends
0
I want If I click #demo the Moduls open and click #modul the iframe opens
0
jack Dont worry.. My main goal here is help other users (and learn with they) 😉😉😉
P.S. If you dont understand something, ask 👍👍
0
Because hiding it make iframe dont break events handling (it cannot receive events when hided) and allow to make all works