2 Replies Latest reply on Jun 1, 2017 12:58 AM by thor erik justo18901148

    Pass parameters to a function

    thor erik justo18901148

      Hi all!

      I have a question about a thing i have been struggling with.


      I have several buttons that i need to pass parameters to a function.


      I am using this tecnique pr now, and it works, but i have a gut feeling that there is a better way:


      this.btn_r_1008.addEventListener("click", function(){ this.theRoomNumber="1008"; getRoomPopUp(); });


      function getRoomPopUp() {

        switch (this.theRoomNumber) {

        case "1008":

        myLocalThis.url2 = "https://romres.ist-asp.com/WebUntis/?school=Dalane#Timetable?type=4&formatId=1&filter.buil dingId=-1&filter.roomGroupId=-1&id=691"


        case "1029":

        myLocalThis.url2 = "https://romres.ist-asp.com/WebUntis/?school=Dalane#Timetable?type=4&formatId=1&filter.buil dingId=-1&filter.roomGroupId=-1&id=692"




      I hope you understand what i am trying to do here.

      In stead of using function(){ this.theRoomNumber="1008" in the addeventlistener, i would like to do it all in the switch  ...