rbush
05-04-2015, 03:18 PM
I have a link that sends the contents of a couple divs to a website to fill out a form. I want to also encode this link but I am not sure exactly how to set that up.
Here are the divs...
<div class="info_line" id="msg_reason" name="msg_reason">
<span class="title" id="reasonLabel">Reason: </span><span id="reasonType">Web-based E-mail sites are blocked</span>
</div>
<div class="info_line" id="msg_threat_source">
<span class="title" id="siteLabel">Site: </span><span id="siteAddress">https://gmail.com/</span>
</div>
and the link...
<a href="https://myytown.org/index.php/create-new-request/new-support-request?new=yes&cat=Internet%20Access%20and%20Browsing&subcat=Access%20Denied%20Requests&reboot=no&subject=Please%20review%20this%20link%20for%20web%20filtering&eid=pontus" target="_blank" id="requestLink" onclick="changeLink();">Click Here to start your Support Ticket</a>
then my script that I have so far, it only applies the div contents to the link...
var reasonLabel = document.getElementById("reasonLabel").innerHTML;
var reasonType = document.getElementById("reasonType").innerHTML;
var siteLabel = document.getElementById("siteLabel").innerHTML;
var siteAddress = document.getElementById("siteAddress").innerHTML;
function changeLink() {
var link = document.getElementById("requestLink");
link.innerHTML = "Click Here to start your Support Ticket";
link.setAttribute('href', "https://myytown.org/index.php/create-new-request/new-support-request?new=yes&cat=Internet%20Access%20and%20Browsing&subcat=Access%20Denied%20Requests&reboot=no&subject=Please%20review%20this%20link%20for%20web%20filtering&eid=pontus&details="+reasonLabel+reasonType+siteLabel+siteAddress);
}
I want to encode the : and the /, which I understand I need to use encodeURIComponent() to do.
Help please!
Here are the divs...
<div class="info_line" id="msg_reason" name="msg_reason">
<span class="title" id="reasonLabel">Reason: </span><span id="reasonType">Web-based E-mail sites are blocked</span>
</div>
<div class="info_line" id="msg_threat_source">
<span class="title" id="siteLabel">Site: </span><span id="siteAddress">https://gmail.com/</span>
</div>
and the link...
<a href="https://myytown.org/index.php/create-new-request/new-support-request?new=yes&cat=Internet%20Access%20and%20Browsing&subcat=Access%20Denied%20Requests&reboot=no&subject=Please%20review%20this%20link%20for%20web%20filtering&eid=pontus" target="_blank" id="requestLink" onclick="changeLink();">Click Here to start your Support Ticket</a>
then my script that I have so far, it only applies the div contents to the link...
var reasonLabel = document.getElementById("reasonLabel").innerHTML;
var reasonType = document.getElementById("reasonType").innerHTML;
var siteLabel = document.getElementById("siteLabel").innerHTML;
var siteAddress = document.getElementById("siteAddress").innerHTML;
function changeLink() {
var link = document.getElementById("requestLink");
link.innerHTML = "Click Here to start your Support Ticket";
link.setAttribute('href', "https://myytown.org/index.php/create-new-request/new-support-request?new=yes&cat=Internet%20Access%20and%20Browsing&subcat=Access%20Denied%20Requests&reboot=no&subject=Please%20review%20this%20link%20for%20web%20filtering&eid=pontus&details="+reasonLabel+reasonType+siteLabel+siteAddress);
}
I want to encode the : and the /, which I understand I need to use encodeURIComponent() to do.
Help please!