Skip to content

Read text file line by line and select random line javascript

I am trying to read a text file filepath = “data/words.txt” and randomly select a line to print in the console. I tried to do: However, I can’t seem to get the file to read. Answer if you want read a text file from the path you need run your code such as node.js environment; but if you using…

How to add additional caption in fancybox

Here’s my setup for the fancybox: I’ve successfully added an additional rightColumn (sidebar) to the fancybox (it’s not captured in the image below) as you can see from the setup. But now I want to add HTML content inside the area which fenced with a red marker on the image below. How can I …

Scrolling issue with Canvas style.left/top

I am making a magnifying glass for a canvas application but ive run into an issue with scrolling. Essentially the goal is to take a canvas and when an image is added (in this case a cgm image) and make a snapshot of it, scale it up and draw it on to a second smaller canvas that overlays it and

Redirect based on the ?id= parameter in the url

I have a login system that I build in PHP and MySQL. if any of my users log in they get directed to the user.php page I have an authenticate.php page that redirects the user based on their ID to a page. This is the code that adds the id to the URL: header(“Location: user.php?id=”.$id); ) Can I wri…