getting a output in javascript to show as a link

Tags: javascript

I have been having troubles how I can get email and website outputs in my var message to show as hyperlinks using the <a> tag. I have the code below any help would be appreciated.

function process() {

    var faculty  = document.getElementById("faculty").value;
    var staff = document.getElementById("staff").value;
    var dr = document.getElementById("dr").value;
    var first_name = document.getElementById("first_name").value;
    var last_name = document.getElementById("last_name").value;
    var cert = document.getElementById("cert").value;
    var title = document.getElementById("title").value;
    var department = document.getElementById("department").value;
    var tel1 = document.getElementById("tel1").value;
    var tel2 = document.getElementById("tel2").value;
    var tel3 = document.getElementById("tel3").value;
    var website = document.getElementById("website").value;
    var email = document.getElementById("email").value;
    var output = document.getElementById("output");

    var output = document.getElementById('output');

    // Create a new object:
    var employee = {
        first_name: first_name,
        last_name: last_name,
        cert: cert,
        title: title,
        department: department,
        email: email,
        phone: tel1 + tel2 + tel3,
        website: website,


    // Create the ouptut as HTML:
    var message = "<h2>Directory:</h2>" + employee.first_name + ", " + employee.last_name + "&nbsp;" + employee.cert + "<br>";
    message += employee.title + "<br>";
    message += employee.department + "<br>";
    message += +"<br>";
    message += "Phone: " + + "<br>";
    message += "Website:" + + "<br>";

    // Display the employee object:
    output.innerHTML = message;

    // Return false:
    return false;



If you want to display a message as a link you can do:

message += "<a href='/"+ employee.title +"'>"+ employee.title +"</a><br>";

similar way to any other element

By : Marcin C.

It looks like a strange issue.

For now, I can suggest you do the following things:

  • Check if your *.jar file is executable. Type sudo chmod +x /opt/xxxx/xxxx-0.0.1.jar to be sure about that and start service again.
  • Try to copy *.jar file to /etc/init.d/ directory instead of creating link. Type cp /opt/xxxx/xxxx-0.0.1.jar /etc/init.d/ and start service again.

Let me know if it helped. If not, maybe we can figure out a different solution.


This video can help you solving your question :)
By: admin