Can this be done with javascript?

admin

Administrator
Staff member
I am rather new to the javascript so I apologize in advance. I need to setup a feedback javascript for my work that grabs the referring URL and the Current URL of a page as well as the title and then sends it to a form that captures these variables. I want this data sent to the following URL: <!-- m --><a class="postlink" href="http://www.mycompany.com/search/feedback.asp?referer=">http://www.mycompany.com/search/feedback.asp?referer=</a><!-- m -->"+TheReferer+"&ThePrevPage="+ThePrevPage+"&rtitle="+TheRefererTitle

How would I incorporate the URL into the following script?

<table border="1" bordercolor="black" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td><span class="propsheading">Property</span></td>
<td><span class="propsheading">Value (your browser)</span></td>
<td><span class="propsheading">JavaScript</span></td>
<td><span class="propsheading">Comment</span></td>
</tr>

<script language="JavaScript">



function WriteTableProps(name,source,comment)
{
var val = "" + eval(source);

// Long URLs cause the table to blow out, so put breaks in to prevent it
if ((val.length > 15) && (val.indexOf(" ") < 0))
{
for (var i=15; i < val.length;)
{
var pos = val.indexOf("/",i);
if (pos > 0)
{
val = val.substring(0,pos+1) + "<br>" + val.substring(pos+1,val.length);
i = pos + 15;
}
else
break;
}

}

document.write('<tr><td><span class="props">' + name + '</span></td>');
document.write('<td width="80"><span class="props">' + val + '</span></td>');
document.write('<td><span class="propscode">' + source + '</span></td>');
document.write('<td><span class="props">' + comment + '</span></td></tr>');
}
WriteTableProps("User Agent","navigator.userAgent","The HTTP user-agent header");
WriteTableProps("Browser","navigator.appName","&nbsp;");
WriteTableProps("Browser Version","navigator.appVersion","&nbsp;");
WriteTableProps("Platform","navigator.platform","&nbsp;");
WriteTableProps("Browser Codename","navigator.appCodeName","&nbsp;");
WriteTableProps("Cookie Enabled","navigator.cookieEnabled","IE 4+, NS 6+");
WriteTableProps("Language","navigator.language ? navigator.language : navigator.userLanguage","Preferred language and country code (NS and IE use different property names)");
WriteTableProps("Java Enabled","navigator.javaEnabled()","&nbsp;");
WriteTableProps("Screen Width","window.screen.width","&nbsp;");
WriteTableProps("Screen Height"," window.screen.height","&nbsp;");
WriteTableProps("Screen Avail Width","window.screen.availWidth","The screen width less any menu bars");
WriteTableProps("Screen Avail Height"," window.screen.availHeight","The screen height less any menu bars");
WriteTableProps("Screen Color Depth","window.screen.colorDepth","In bits");
WriteTableProps("ThePrevPage","document.referrer","The web page URL that linked to the current page (if any)");
WriteTableProps("TheRefererTitle","document.title","Title from the TITLE tag");
WriteTableProps("TheReferer","document.URL","URL of the current page");
WriteTableProps("Last Modified","document.lastModified","Date that the page was last modified");

</SCRIPT>

</table>

</HTML>

I'm fairly confident that this can be done. Anyone that can help me I would be very grateful.
 
Back
Top