Hi all,
I have a link on my page that allows users to add a title (heading) to the page. It does so by showing a textbox and button when they click on the "Click to add title" link. I'm basically trying to tack a "title" param to the current url like this:
The code above fails, but when I wrap part of my onClick event in an alert() it works (section in bold below), but I also obviously get the alert which I don't need....
Thanks in advance for any help!
I have a link on my page that allows users to add a title (heading) to the page. It does so by showing a textbox and button when they click on the "Click to add title" link. I'm basically trying to tack a "title" param to the current url like this:
Code:
<a href="javascript:;" onClick="document.getElementById('HiddenForm').style.display='block'; document.addTitle.titleBox.focus();">Click to add title</a>
<div id="HiddenForm" style="display: none;">
<form style="margin-top: 0;" name="addTitle">
<input name="titleBox" type="text" size="50">
<input type="button" value="Add Title" onClick="document.location.href = document.location.href + '&title=' + document.addTitle.titleBox.value; document.location.reload();">
<input type="button" onClick="document.getElementById('HiddenForm').style.display='none';" value="Cancel" />
</form>
</div>
The code above fails, but when I wrap part of my onClick event in an alert() it works (section in bold below), but I also obviously get the alert which I don't need....
Code:
<a href="javascript:;" onClick="document.getElementById('HiddenForm').style.display='block'; document.addTitle.titleBox.focus();">Click to add title</a>
<div id="HiddenForm" style="display: none;">
<form style="margin-top: 0;" name="addTitle">
<input name="titleBox" type="text" size="50">
<input type="button" value="Add Title" [B]onClick="alert(document.location.href = document.location.href + '&title=' + document.addTitle.titleBox.value); document.location.reload();"[/B]>
<input type="button" onClick="document.getElementById('HiddenForm').style.display='none';" value="Cancel" />
</form>
</div>
Thanks in advance for any help!