#i have three buttons and when they click that button, they will be redirected to an another html fil

25 messages · Page 1 of 1 (latest)

craggy crane
#

i created three buttons and our instructor want us to whenever someone tries to click that three button, they will be redirected to an another html saved in my laptop. Our instructor want us to use a function for that and i have no idea how to do that.

#

so when they click to wishlist, add to cart, and checkout button, they will be redirected to this html file order form i made

thorny magnet
#

It seems a bit extra to use a function to redirect the user.

#

Normally, you'd use an anchor tag

#

And let it handle redirecting you

thorny magnet
craggy crane
#

document.getElementbyId(button id).onclick(function());

#

then add the file path of my html file??

#

right

thorny magnet
craggy crane
#

my mates did something like this

thorny magnet
#

does it work?

craggy crane
#

it worked for him, i think

#

not really sure, but i asked my instructor if i can use <a> tag

#

and he said we can use it

thorny magnet
#

That's better

craggy crane
#
    <script>
        function getorderform(){
            location.href = "C:/Users/jayne/kodegobootcamp/Josol, Jayne Ceilo Y._WD42P_Exercise2_Form.html"
        }
    </script>
#

i did this

#

i did some googling but i cant find what to write after. they use online links as an example so i was having some trouble finding what to use when you want to get the file locally

thorny magnet
craggy crane
#

i needed help before, but now i solved it

#

thanks though

thorny magnet
#

ah alright

fading willow
#

I would assume the idea of using a function has to do with adding the cart/wishlist functionality