JavaScript Function, Passing arguments

Is a dynamic computer programming language.[5] It is most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.[5] It is also used in server-side network programming with runtime environments such as Node.js, game development and the creation of desktop and mobile applications.
Post Reply
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

JavaScript Function, Passing arguments

Post by dzcadii » Sun Mar 01, 2015 11:00 pm

Need to use <a href="">Something</a> and let JavaScript handle it?
Say you want to open new window and display certain content based on query arguments.
Here is a simple "How to"

<!-- HTML page index.html -->

Code: Select all


<script language="JavaScript" type="text/javascript">
function open_me(url,app,action){
var url = url;
var app = app;
var action = action;
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);

if(browser=="Microsoft Internet Explorer" && version=="7.0"){"?app="+app+"&action="+action, "MyWindow", "width=500 height=400");
else{"?app="+app+"&action="+action, "MyWindow", "width=500,height=400");



<a href="javascript:open_me('','0','0');">Open a new page</a>


Post Reply