L
lawrence
I've been trying to adapt this script to fit my needs, but I can't get
it to work. I'm trying to put my values in the status bar so I can see
if my variables have the right values, but I get an "Error on page"
error, so I can't read anything in the status bar.
What am I missing?
function placeImageAtCursor(myField) {
var imageName = '';
var path = '';
var myValue = '';
imageName = document.forms.pdsForm.imagesToInsert.value;
path = 'http://www.publicdomainsoftware.org/mcImages/';
myValue = path+imageName;
window.status= myValue;
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
} else if (myField.selectionStart || myField.selectionStart == '0')
{
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos) + myValue +
myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
This is the form element that should be calling:
<br>Insert an image: <select id="imagesToInsert"
onchange="placeImageAtCursor(document.formName.fieldName);">
<option value=""></option>
<option value="">No choice made</option>
<option value="emma.jpg">Emma sticks out her tongue</option>
<option value="Ellen_and_Rob_cleaning_Bunkhouse_9-97.JPG">Rob Kurtz,
Ellen, clean the bunk house in 1997</option>
<option value="052898-31_Eryn_smoking_cigarette.jpg">Woman in
red</option>
<option value="publicPen_log.gif">Public Pen Logo</option>
<option value="biglettuce.JPG">big lettuce</option>
<option value="vegetables2.JPG">mod vegetables</option>
<option value="vegetables2.JPG">mod vegetables</option>
<option value="lettuce.JPG">lettuce</option>
<option value="lettuce.JPG">lettuce</option>
<option value="lettuceStripsCropped.JPG">lettuceStrips</option>
<option value="lkImage03.jpg">Lawrence and his dad</option>
</select>
it to work. I'm trying to put my values in the status bar so I can see
if my variables have the right values, but I get an "Error on page"
error, so I can't read anything in the status bar.
What am I missing?
function placeImageAtCursor(myField) {
var imageName = '';
var path = '';
var myValue = '';
imageName = document.forms.pdsForm.imagesToInsert.value;
path = 'http://www.publicdomainsoftware.org/mcImages/';
myValue = path+imageName;
window.status= myValue;
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
} else if (myField.selectionStart || myField.selectionStart == '0')
{
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos) + myValue +
myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
This is the form element that should be calling:
<br>Insert an image: <select id="imagesToInsert"
onchange="placeImageAtCursor(document.formName.fieldName);">
<option value=""></option>
<option value="">No choice made</option>
<option value="emma.jpg">Emma sticks out her tongue</option>
<option value="Ellen_and_Rob_cleaning_Bunkhouse_9-97.JPG">Rob Kurtz,
Ellen, clean the bunk house in 1997</option>
<option value="052898-31_Eryn_smoking_cigarette.jpg">Woman in
red</option>
<option value="publicPen_log.gif">Public Pen Logo</option>
<option value="biglettuce.JPG">big lettuce</option>
<option value="vegetables2.JPG">mod vegetables</option>
<option value="vegetables2.JPG">mod vegetables</option>
<option value="lettuce.JPG">lettuce</option>
<option value="lettuce.JPG">lettuce</option>
<option value="lettuceStripsCropped.JPG">lettuceStrips</option>
<option value="lkImage03.jpg">Lawrence and his dad</option>
</select>