1

I have a html input button which calling this function

<button class="Go" onClick="go();" disabled><div class="inner first">Nah...Not Yet</div></button>

But this script I created in another javascript which code like this name "test.js"

function go()
{
    window.location.href = 'https://google.com';   
}

How should I input the scriptype for the input button in order to call this function?

1
  • No need for the semicolon in the onclick. Commented May 28, 2016 at 14:55

1 Answer 1

1

You should add a tag in your html, and all will be fine

<script type="text/javascript" src="test.js">
Sign up to request clarification or add additional context in comments.

2 Comments

Do you know any way to hide this ? for example. if i view page source. people able to see my test.js and download it. how i going prevent them?
If you want to hide the javascript inclusion, you have to do it serverside. It depends of your server language (if any). In Java, for instance, it could be <%@include file="test.js" %>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.