Scripting

  Home  Client Side Scripting  Scripting


“Client side Scripting frequently Asked Questions in various Scripting job Interviews by interviewer. The set of Scripting interview questions here ensures that you offer a perfect answer to the interview questions posed to you. Get preparation of Scripting job interview”



9 Scripting Questions And Answers

2⟩ Explain how to validate website address using JavaScript? User should not be allowed to enter special characters except hyphen(-)?

function ValidateWebAddress(field,alerttext)

{

with(field)

{

var companyUrl =value;

var RegExp = /^(([w]+:)?//)?(([dw]|%[a-fA-fd]{2,2})+(:([dw]|%[a-fA-fd]{2,2})+)?@)?([dw][-dw]{0,253}[dw].)+[w]{2,4}(:[d]+)?(/([-+_~.dw]|%[a-fA-fd]{2,2})*)*(?(&?([-+_~.dw]|%[a-fA-fd]{2,2})=?)*)?(#([-+_~.dw]|%[a-fA-fd]{2,2})*)?$/;

i f(RegExp.test(companyUrl)) {

return true;

}

else

{

alert(alerttext);

return false;

}

}

}

Call this fuction in an if else structure

Pass the field name and an alert string

if(validate_r(website,"Need to specify your site")==false)

{

return false;

}

 186 views

3⟩ How to disable back button in Mozilla?

<html><head>

<title>noBack</title>

<script type="text/javascript">

function noBack(){window.history.forward();}

</script>

</head>

<body onload="noBack();" onpageshow="if(event.persisted)noBack();" onunload="">

...blabla...

</body></html>

 196 views

4⟩ Explain how to load .so (in linux), DLL in windows in PERL?

[root@atmlab05 bin]# ldd ns

libotcl.so => not found

libtk8.2.so => not found

libtcl8.2.so => not found

libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4001b000)

libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40026000)

libnsl.so.1 => /lib/libnsl.so.1 (0x400c3000)

libdl.so.2 => /lib/libdl.so.2 (0x400d8000)

libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2

(0x400db00

0)

libm.so.6 => /lib/libm.so.6 (0x4011d000)

libc.so.6 => /lib/libc.so.6 (0x4013a000)

/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

 197 views

7⟩ How to disconnect the vpn client in VB Script?

My users have found this helpful. When a user has a drive mapped (especially in XP) on a laptop, it can sometimes slow the system down looking for the drive when not connected to the network. This solution allows them to connect to the Network drives only when they want to if in the local office or through VPN.

'Although DirectConnect works welll, not all of us have the resources for that.

This script will look up a set of network drive, and if connected, disconect them, or if not connected, connect them.

additional code could be added to connect printers, or even test the network before attempting connection.

 188 views

9⟩ Explain how to execute WScript & WSH object? How will i create WSH objects?

The WScript object is directly available to all scripts being executed by wscript or cscript and represents the currently running instance of the scripting host executable (wscript or cscript). The WScript object cannot be instantiated directly using CreateObject, however scripts running under WSH can obtain a reference to it via the Application property.

Through the WScript object one can gain access to WSH version information, the paths to the host executable and the script currently being executed, any arguments passed to the script, and the standard input, output and error streams. In addition, the WScript object can be used to instantiate, obtain references to, and bind to COM components. Methods and properties are also available to alter the script timeout values, and to cause the script to sleep for a specified period of time.

 177 views