- This topic is empty.
April 18, 2015 at 8:52 am #200672sallyd09Participant
For my website, I’m creating an array that randomly displays an image and associated text each time. I’ve gotten the array to work, but the first line of text starts on the bottom right corner or the image. How do I get the image to flush left and the text to start on the top with the image? My current display method is using document.write(random_img[random_number]);
var r_text = new Array ();
r_text = “Adrian’s online program is totally unique and his approach is founded on the principle that your career should really just be another way to express yourself. I am deeply grateful to have found a more fitting career in brand management and I hope to start a business down the road.<br>Matt, San Francisco”;
r_text = “I can tell you that after 3+ months using this career pathfinding program that my career outlook has never been better! I am currently going through a complete career change that I would have never dreamed about before I started this program. <br>Conrad, San Francisco”;
var random_img = new Array();
random_img = ‘‘;
random_img = ‘‘;
var total_testimonials = 2;
var random_number = Math.floor((Math.random()*total_testimonials));
document.write(r_text[random_number]);April 18, 2015 at 9:04 am #200673Paulie_DModerator
If this is a layout matter I doubt if the JS is relevant.
We’d need to see the output HTML & CSS in a codepen demo.April 23, 2015 at 3:34 am #200963ChromawoodsParticipant
Even without knowing how your HTML and CSS looks, I would not recommend using document.write:
- You must be logged in to reply to this topic.