Been experimenting a bit with javascript, there are two issues I had with 
it. #1 is probably just an QT issue,
#1. This should work (works in chrome), but the image is not displayed in 
mnemosyne:

CARDCODE:
-------------------------------
<SCRIPT LANGUAGE="JavaScript">var x = 100;var y = 50;var imageFile = 
"basal-ganglia.jpg";</SCRIPT><SCRIPT LANGUAGE="JavaScript" 
SRC="placeDot.js"></SCRIPT>


placeDot.js:
-------------------------------
window.onload=placeDot;
window.onresize=placeDot;

// Write picture and dot html to document
document.write("<div id=\"pic\" style=\"position:absolute\"><img src=\"" + 
imageFile +"\"></div><div id=\"dot\" 
style=\"position:absolute\"><b>x</b></div>")
alert (imageFile);
function placeDot(){
//offset relative to dot size
    x += 1;
y += 1;
// Center image
document.getElementById("pic").style.top = 0;
document.getElementById("pic").style.left = 
(window.innerWidth/2)-(document.getElementById("pic").offsetWidth/2);
    // Position dot
document.getElementById("dot").style.left = x + 
document.getElementById("pic").offsetLeft;
document.getElementById("dot").style.top = y;
//alert (document.getElementById("pic").style.left);
}




#2. Instead of writing the image to the document I placed it in the html. 
This is not that dynamic, but it works. There is a problem and that is that 
the outer card frame is not 100% in height. I think this has do do with 
that the the outer html is different when I did the testing in chrome, but 
I'm not entirely sure.

HTML CODE FOR TESTING IN CHROME:
-------------------------------
<html>
<head>
<title>JS place test</title>

</head>
<body>
<table width="100%" border="0" align="center">
  <tr>
    <td align="center" valign="middle">
    <table>
<div id="pic" style="position:absolute"><img src="basal-ganglia.jpg"></div>
<SCRIPT LANGUAGE="JavaScript">
// setting custom variables
// dot position
var x = 100;
var y = 50;
// map file
var imageFile = "basal-ganglia.jpg";
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="placeDot.js">
</SCRIPT>
</table>
</td>
  </tr>
</table>
</body>
</html>


CARDCODE:
-------------------------------
<div id="pic" style="position:absolute"><img src="basal-ganglia.jpg"></div>
<SCRIPT LANGUAGE="JavaScript">var x = 100;var y = 50;var imageFile = 
"basal-ganglia.jpg";</SCRIPT><SCRIPT LANGUAGE="JavaScript" 
SRC="placeDot.js"></SCRIPT>


placeDot.js:
-------------------------------

window.onload=placeDot;
window.onresize=placeDot;

// Write picture to document
//document.write("<div id=\"pic\" style=\"position:absolute\"><img src=\"" 
+ imageFile +"\"></div>")
//  and dot html
document.write("<div id=\"dot\" style=\"position:absolute\"><b>x</b></div>")
alert (imageFile);
function placeDot(){
//offset relative to dot size
    x += 1;
y += 1;
// Center image
document.getElementById("pic").style.top = 0;
document.getElementById("pic").style.left = 
(window.innerWidth/2)-(document.getElementById("pic").offsetWidth/2);
    // Position dot
document.getElementById("dot").style.left = x + 
document.getElementById("pic").offsetLeft;
document.getElementById("dot").style.top = y;
//alert (document.getElementById("pic").style.left);
}

-- 
You received this message because you are subscribed to the Google Groups 
"mnemosyne-proj-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/mnemosyne-proj-users/-/TNUg-oOh6Y0J.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to