Can I pass a string variable into an <a href> tag for a website link?
- by Joseph
I am somewhat new to web developing, so I am trying to learn along the way. I have a div that is 500 x 500. Inside of that div I have two divs that are each 250x500. So my outer div is filled up with the two inner divs.
I have it setup so that when I click on the first div (the left one) a java script is called, and a prompt pop up box asks for a website URL which is then stored inside of a string variable.
How can I make it so that the second div (the right one) takes the string variable from the alert box from the left div and puts it into an a href tag so that I can link to the website from the right div?
Can a a href tag accept a value from a variable for its link? Maybe I am going about this all wrong, is there a better way I should be approaching this? Any help is appreciated!!