MikP 0 Newbie Poster

Hi all,

I'm a n00b at Python and am working on outputting html using pyhtmloo - I've checked the pyhtmloo site for guidance but no joy there. Hopefully I'll find guidance here...

The python code below outputs an html page and what I'd like to do is set the refresh meta tag in the header e.g.

<meta http-equiv="refresh" content="2;url=http://www.site.com/newpage.html">

Also, if anyone knows how, I'd like to set the refresh url with a javascript variable (so, a js var thru python to html!) - this is the second code block below.

I'm happy to research this too so if anyone knows where I might find info to work it out myself I'll be equally grateful.

python code:

print html(
		head(
			title(TITLE),
			script(jscript),
			link(href=STYLE_SHEET,rel='stylesheet')),
		body(
			h1(TITLE,CLASS="head1"),
			h3('Transaction posted',CLASS='head3'),
			p(a('Click here to continue...',href='#',onclick='re_dir()'))
			))

What I have at the moment is a link displayed which onclick calls a js function (re_dir()) using a variable (page) already set to take the user to their original destination - this link works fine...now I'd like to have this page refresh automatically taking the user to the url.

javascript set in python:

jscript='''
	
	function re_dir() {
	var page = document.location.search.substr(1);
	top.location.href = ('http://www.site.com/index.html?' + page);
}
	'''

Thanx in advance.
Mik.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.