A
automatyk
I need to change an href on an existing link in my document depending
on some user input.
I was able to get this to work in Firefox, but the behavior in IE is
troubling. The new link works in both browsers, however, IE rewrites
the entire link text! This is my code:
<script type="text/javascript">
function getContractNum() {
var cNum = document.forms[0].contractNum.value;
var cNum1 = document.forms[0].contractNum1.value;
var cComplete;
if (cNum != '') {
subjectline = cNum;
} else if (cNum1 != '') {
subjectline = cNum1;
} else {
subjectline = 'x';
}
var newlink = 'mailto:[email protected]?subject=Rep Payee%20:%20' +
subjectline;
var target = document.getElementById("dynamicsubject");
target.setAttribute('href', newlink);
}
</script>
My HTML contains a form with a couple of inputs and a link.
<a id="dynamicsubject" href="mailto://[email protected]">Click here to
send email.</a>
Firefox behaves as you'd expect... the href is changed and the link
text is the same.
Internet Explorer however displays:
mailto:[email protected]?subject=Rep Payee%20:%20x
The link works in both cases! Can anyone help me figure this out?
It's been driving me crazy all day!
Thanks.
on some user input.
I was able to get this to work in Firefox, but the behavior in IE is
troubling. The new link works in both browsers, however, IE rewrites
the entire link text! This is my code:
<script type="text/javascript">
function getContractNum() {
var cNum = document.forms[0].contractNum.value;
var cNum1 = document.forms[0].contractNum1.value;
var cComplete;
if (cNum != '') {
subjectline = cNum;
} else if (cNum1 != '') {
subjectline = cNum1;
} else {
subjectline = 'x';
}
var newlink = 'mailto:[email protected]?subject=Rep Payee%20:%20' +
subjectline;
var target = document.getElementById("dynamicsubject");
target.setAttribute('href', newlink);
}
</script>
My HTML contains a form with a couple of inputs and a link.
<a id="dynamicsubject" href="mailto://[email protected]">Click here to
send email.</a>
Firefox behaves as you'd expect... the href is changed and the link
text is the same.
Internet Explorer however displays:
mailto:[email protected]?subject=Rep Payee%20:%20x
The link works in both cases! Can anyone help me figure this out?
It's been driving me crazy all day!
Thanks.