S
stepheno
I want to run some Javascript from the address bar (newlines included
for readability):
javascript:
location='http://www.example.com/page.html';
var num =
document.getElementById('content').getElementsByTagName('input')
[0].value;
document.write("Number is" + num);
In English:
1. Load a page
2. Get "123" from <div id="content"><input value="123" /></div>
3. Display the number ("123") to the user
I need to work when put in the address bar at any URL. However, it
only seems to work from 'http://www.example.com/page.html' (i.e. the
page I'm intending to load.)
Any ideas?
for readability):
javascript:
location='http://www.example.com/page.html';
var num =
document.getElementById('content').getElementsByTagName('input')
[0].value;
document.write("Number is" + num);
In English:
1. Load a page
2. Get "123" from <div id="content"><input value="123" /></div>
3. Display the number ("123") to the user
I need to work when put in the address bar at any URL. However, it
only seems to work from 'http://www.example.com/page.html' (i.e. the
page I'm intending to load.)
Any ideas?