简体   繁体   中英

how to transfer data from one html page to another without using forms and input tags

For eg; following is the html snippet for the short summary of hotel rooms in HotelRooms.html

<div class="Room1"  onclick="window.location.href='RoomDescription.html'">
        <div class="roomInfoaltered">
          Luxury room 1 <br>
          <span style="font-size:18px; font-family:Tillana">PKR 4,250</span>
        </div>
      </div>

<div class="Room2" onclick="window.location.href='RoomDescription.html'">
        <div class="roomInfoaltered">
          Twin room 3 <br>
          <span style="font-size:18px; font-family:Tillana">PKR 8,250</span>
        </div>
      </div>

I want to get the values of either div I click on RoomDescription.html page. How can i send Info as Room Type="Twin room 3" and price="8250" from HotelRooms page to RoomDescription page. Moreover how to get the parameter values on RoomDescription.html page. I realize the form method is much convenient but didn't learned it till now after designing my whole page.

Well, you could use cookies to do so, but based on the context of your post, that would not be a good idea as cookies can be modified by the user. The best option is honestly forms, and practically all of the ways I can think of transferring data between pages besides that can be targeted and modified.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM