Welcome to WebmasterWorld Guest from 54.226.143.14

Forum Moderators: open

Message Too Old, No Replies

link disappears from javascript variable

A very simle link generator to insert a voucher

   
11:23 am on Nov 11, 2012 (gmt 0)

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



This should be very simple

<FORM NAME=makelink>
Copy the voucher code: <input type=TEXT name=voucher onchange=makethelink() size=26>
<input type=button value="Link aufbauen" onclick=makethelink()>

</FORM>

<script language="JavaScript">
function sete(e,h,v){if(!v){v=mt[h]}try{document.getElementById(e).innerHTML=v}catch(e){}}

function makethelink()
{ with (document.makelink) {
var link = "https://www.example.com/ecom/gb.php?c=cart&i=1168918&cl=202501&ejc=2&discount_code=" + voucher.value;
var html = link + '<br><br><a href="'+link+'" target=_blank>Download Link</a>';
sete('for_link', '',html );
alert ( html );

}
}
</script>

<span id=for_link></span>


But there is only "Download link" without link. So I inserted the alert to view waht happens. In the alert is also not the <a href for the link.

I tried what happens when I write <span style= instead of <a href=
The alert shows like expected the variable html.
But when I put <a href, the alert does not show this.

Any idea what went wrong with this very simple script?

I tried with simple links <a href=http://mysite.com>download link</a>
and it works like expected.

It only refuses to work with the online shop link and I have no idea why
11:36 am on Nov 11, 2012 (gmt 0)

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



I just tested to copy my example in a simple

<html>

copy of the above code

</html>

And it works. But it does not work with my page.
The link dispappears from the var html watched by the alert
11:47 am on Nov 11, 2012 (gmt 0)

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Oh, was a shut in the own knee.
Seems my own CMS eleminated it direct out of the javascript

The solution

<a hr'+'ef

To avoid that the CMS finds an <a href instruction
 

Featured Threads

Hot Threads This Week

Hot Threads This Month