How to achieve certain effects. Posts are mainly based on search keywords that visitors used and their necessity for psychological experiments. Posts generally assume MSIE (5.1 and up).
Friday, August 04, 2006
HTML Application tool for scoring videofragments in psychology and social science research.
There are impressive examples of what you can do with HTML applications. Here is the famous Word like editor application example of Microsoft. Guido needed an application that would make scoring the video fragements he recorded of emotional behavior in children easier and more acurate. Although commercially available packages exist, for example Observer, these are expensive and offer far more features than necessary. More importantly they are accompanied by a dongle and so only one installation can be used at a time and only at the university. This is not very convenient for Guido's students, who are doing much of the scoring. They would like to be able to do it on their own computer, and they don't want to set up a schedule for sharing with other students. So I started to build a HTA, because that saves me a bit of time compared to building a full blown application in C. Furthermore, it suffices generously. It is now in a state where I think it might be useful for others, at least as an example of what you can do with HTA. The interface is however fully in Dutch (could be translated if there is enough interest). You can find a screenshot here: 'filmpjes-scoren' screenshot. You can download the installer from this link.
Monday, April 24, 2006
Saving web form data to file
If you want to use webpages and DHTML to do experiments or fill out questionairs, the problem is saving the data to a file on the hard drive for statistical analysis. If your web-form is on a online webpage this not too difficult (e.g., using a mail-form—see this page). But if you want to collect data offline, you would like to able to save those data to a file on the hard drive. How to get access to the hard disk from within a webpage is explained here, but it is more convenient to have javascript code that works for any form on a webpage. To this end I created a Javascript object that gathers the data from a form, and—in Internet Explorer—can write it to the hard disk in the comma separated values (".cvs") format. Part of the code is based on code from this website. An example and a detailed explanation can be found here. A zip file containing the .js library file and the example and documentation can downloaded here.
Wednesday, December 21, 2005
Detecting the popup-blocker
It is often useful to be able to open a new window to present the page containing the intended content (e.g., a page containing the actual experiment as was done here) in a way that is not possible from the user openen browser window. For example, you may want to get rid of the menu and toolbar, and have the window span the entire screen. This is easily achieved using the window.open function. The problem is that most web surfers have a popup blocker activated. There's no way to circumvent this, but you would like to be able to detect wether the creation of the popup window succeeded. Then you can present a warning to the user, explain the problem, and instruct the user to click a link on the current page to try again (the popup blocker doesn't block popups that are the direct result of a click event by the user). In MSIE you can use the window.createPopup function to create a popup that won't be blocked (this type of popup is subject to the restriction that only one popup can be open at the same time), but this is not available in other browsers. Here's a simple example:
It doesn't necessarily have to be a click event, it can also be a keydown event. For example if you first click the square below and press the 'a' key, a popup window will appear. This is achieved by setting
<html>
<head>
<script>
url = 'http://www.google.com'
message = "A popup-blocker was detected!"
message += " Please click the link to try again."
popupProp = "fullscreen=yes, toolbar=no"
function openIt() {
var w = window.open(url, '_blank', popupProp)
if(!w) // popup was blocked
alert(message)
}
</script>
</head>
<body onload="openIt()">
<h1>
If the window doesn't open
<a href=# onclick="openIt()">
click here
</a>
to try again.
</h1>
</body>
</html>
If you move your mouse over the square below you can see the above script in action.
Move your mouse over this square.
If the window doesn't open
click here
to try again.
onkeydown="if(event.keyCode==65) openIt()". (See this post for making this compatible with Firefox.)
If this square has focus and the 'a'-key is pressed, a popup will open without being blocked.
Subscribe to:
Posts (Atom)