What am I doing wrong?
<input type='text' name='keyword' id='keyword' size='16'>
<a href= "" onclick="window.open('.getElementById('keyword')');">
it opens a new window with without q = keyword.
What am I doing wrong?
<input type='text' name='keyword' id='keyword' size='16'>
<a href= "" onclick="window.open('http://scholar.google./scholar?q=document.getElementById('keyword')');">
it opens a new window with without q = keyword.
You need to have document.getElementById('keyword')
as part of the code, not the hyperlink.
<input type='text' name='keyword' id='keyword' size='16'>
<a href= ""
onclick="window.open('http://scholar.google./scholar?q=' + document.getElementById('keyword') + '');">
You have the getElementById
enclosed in quotes.
It should be:
<a href="" onclick="window.open('http://scholar.google./scholar?q=' + document.getElementById('keyword').value);">
Declaring document.getElementById('keyword')
doesn't automatically give you the value written in it. For that, you need to do document.getElementById('keyword').value
.
What you probably want to do is this:
<a onclick="window.open('http://scholar.google./scholar?q=' + document.getElementById('keyword').value);">Click here</a>