Click here to Skip to main content
15,889,216 members

Comments by Bob@work (Top 19 by date)

Bob@work 17-Nov-22 17:24pm View    
You can create a script that alters the iframe URL's clock parameter. I don't think you can reach into the iframe's page and alter the clock - might be a cross-site security issue.

You'll need to alter the parameter for the clock faces you want to scroll through and then assign the new value to the iframe url. You can assign the value from a list, clickable images, random values. Changing to a digital watch:

var myClockFrame=document.getElementById('iframeclock');
var clockfaceid="040";
myClockFrame.src="https://www.clocklink.com/html5embed.php?"+
"clock="+clockfaceid+
"&timezone=UnitedKingdom_London"+
"&size=150"+
"&From=2022,1,1,0,0,0";
Bob@work 20-Sep-22 18:37pm View    
You can create the list, sort it and then add the first two items and last two list items to get the min and max. The answers will be 6 (2+4), and 101 (45+56).

Something like:

nums = [6,4,12,9,45,23,2,43,56,17,20,11,7]
print(nums)
nums.sort()
print(nums)
print(nums[0]+nums[1])
print(nums[len(nums)-1]+nums[len(nums)-2])
Bob@work 30-Mar-22 16:04pm View    
The example sample site works properly in Chrome Version 99.0.4844.84 (Official Build) (64-bit). Code is much different than what you have under "What I have tried:".

According to the mapbox help site, multiple markers need to be added to a set of markers - your code simply acts to move the one marker you are creating and replacing with each click. The line that adds the current click coordinates to the set of markers is:

c.push(coordinates);

See:
https://docs.mapbox.com/help/getting-started/add-markers/#:~:text=To%20add%20multiple%20markers%2C
Bob@work 16-Nov-21 13:48pm View    
If you're trying to capture the URL of an image: right click, copy image location.
If you're trying to save an image: right click, save image.
if it's something else you're after,

A few things to research -
1. x is the url of the web page running the script, not an image.
2. document.getElementsByTagName('x'); will return an array of all elements with the tag name "x". The missing 's' in the getElements... function causes an error.
3. document.getElementsByTagName('x') returns an array of elements that aren't used elsewhere in the script.
4. An image is created, but never used.
document.getElementsByTagName('x')[0].appendChild(img);
will add the image to the first element wrapped in an <x> html tag.

The following edits to your script, wrapped in an HTML page, can be used to see how the script can add an image to the page.

<html><head><title>image test&l;title>
<style>
x {border:solid 3px #dedede;
display:block;
padding:3px;
}
p{border:dashed 1px green;
}
<style>
<script>
function testImg(){
var x = document.URL;
document.getElementsByTagName("x");
var img = document.createElement("img");
img.src = x;
img.style="height:100px;width:100px;border:solid 2px red;";
alert(img);
document.getElementsByTagName('x')[0].appendChild(img);
}
<script>
<head>
<body onclick="testImg();">
<x>This is an element wrapped in an "x-tag">x>
<p>Click anywhere on the page to run the test script...>p>
<body>
<html>
Bob@work 16-Nov-21 13:47pm View    
Deleted
If you're trying to capture the URL of an image: right click, copy image location.
If you're trying to save an image: right click, save image.
if it's something else you're after,

A few things to research -
1. x is the url of the web page running the script, not an image.
2. document.getElementsByTagName('x'); will return an array of all elements with the tag name "x". The missing 's' in the getElements... function causes an error.
3. document.getElementsByTagName('x') returns an array of elements that aren't used elsewhere in the script.
4. An image is created, but never used.
document.getElementsByTagName('x')[0].appendChild(img);
will add the image to the first element wrapped in an <x> html tag.

The following edits to your script, wrapped in an HTML page, can be used to see how the script can add an image to the page.

<html><head><title>image test>title>
<style>
x {border:solid 3px #dedede;
display:block;
padding:3px;
}
p{border:dashed 1px green;
}
>style>
<script>
function testImg(){
var x = document.URL;
document.getElementsByTagName("x");
var img = document.createElement("img");
img.src = x;
img.style="height:100px;width:100px;border:solid 2px red;";
alert(img);
document.getElementsByTagName('x')[0].appendChild(img);
}
>script>
>head>
<body onclick="testImg();">
<x>This is an element wrapped in an "x-tag">x>
<p>Click anywhere on the page to run the test script...>p>
>body>
>html>