Can this be created in javascript. A timer?

That’s all wrong. You keep going wrong when you try to step away from the instructions, that wer most recently shown in post #130

Let’s check that code over starting from the top. I see from line 1 of the code that it fails from step 1 of those instructions.

You said this wasn’t complicated.

It’s not complicated when you follow the instructions. I did it with three images in a total of two minutes.

1 Like

You’re an expert.

Back to the instructions in post 130 I want you to observe two things.

First, what is the first instruction listed there, and next, what is the first thing shown in your code.

script to start the timer for image 1

Okay, and the first thing in your code is not the script. Is it.

Next on to the second instruction from post #130, which your code is currently failing at too.

script to end the timer for image 1

No, that’s the third instruction. You need to get the second one right first, before moving on to the third.

Normally there are lots of things that we can do to check that things are properly working, at every step and every stage of this task.

However, as you don’t want to use the console, which is used to help provide verification checks, the really easy stuff is just not available to you.

I need a break.

I’ll have to go soon too.

Right, I’m back.

Currently your code has been confirmed to be all good at step 1, and step 2 needs to be worked on before checking the rest.

Given that the console seems to be out of bounds for you, here are the steps that lead to your easiest success.

  1. script to start the timer for image 1
  2. image 1
  3. script to end the timer for image 1
  4. a div to show the results of the timers
  5. a script that uses each of the timers to create the measurement from them
  6. a script that shows the measurement in the above results div
  7. a script that cleans up the stored markers
1 Like

Ahem. :-) Sorry I don’t wanna spoil the party, but again this won’t work reliably. That a given script is placed before an image tag doesn’t mean that the browser stops loading content in the background until that script got evaluated and executed; you can read more about this behaviour in a very good article here.

Of course setting a simple timer won’t take ages to execute, but we’re talking about high res timestamps here. So the bottom line is, you’ll either have to set the image source with JS, or better yet use the dev tools to measure loading times. There might also be some APIs available to do this with JS, but naturally this would be browser specific.

I think you’ve missed the point.

I believe the OP doesn’t understand how to use the console, and imagines this approach is easier than learning how to do so.

1 Like

Yes I agree that there are better ways to do things, but I’m currently working within the limitations of what asasass is willing to do. When the current example has been got working, that then will be a good time to explore and investigate other techniques that use pure scripting only, and compare their accuracy.

1 Like