Javascript help please

Bes

Bes

Soldato
Joined
18 Oct 2002
Posts
7,318
Location
Melbourne
Hi

I have a form on my page with a dropdown... When the user changes the option in the dropdown, I want a chunk of javascript to be run again, how can I do this?

I can't simply wrap it in a function, as I am using a third party script that calls on a bunch of external scripts, and it messes all that up if I do.

This is the drop down:

Code:
<form name="crop" enctype="multipart/form-data">
<select name="htmlFormAspect" onclick="something???()">
<option value="1">Standard</option>
<option value="2">Large</option>
<option value="3">Extra Large</option>
</select>
</form>

I want to rerun the following javascript:

Code:
<img id='testImage' alt="Test image" src="render/rszL.php" width="500" />
<div id="previewWrap"></div>
 
<script type="text/javascript" language="javascript">
var x;
var y;
if (document.crop.htmlFormAspect.value==1)
{
	x=180;
	y=120;
}
else
{
	x=10;
	y=10;
}

    Event.observe( window, 'load', function() {
        new Cropper.ImgWithPreview(
            'testImage',
            {
                previewWrap: 'previewWrap',
                minWidth: x, minHeight: y, 
				ratioDim: { x: x, y: y },
                onEndCrop: onEndCrop
            }
        );
    } );
</script>

Thanks
 
Back
Top Bottom