Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resize a Div

Status
Not open for further replies.

tc3596

Technical User
Mar 16, 2001
283
My project is to create a Gantt chart. I found some code online that does what I need, now I need to be able to resize the graph bar. It would end up resembling what you can do in Excel through cells.

I have an HTML page that uses a js script as it's source. I know in the code where to put the onmouseDown event, but not sure what to put in the function. Here is a function someone said would work but does not...

this.mouseDown = function (dragEvent, which){

var posX = 0;
var posY = 0;
var newXsize = 0;
var newYsize = 0;
var maximumXsize = 750;
var maximumYsize = 750;
var minimumXsize = 0;
var minimumYsize = 0;


posX = eval("document."+which+".offsetLeft");
posY = eval("document."+which+".offsetTop");
newXsize = dragEvent.x;
newYsize = dragEvent.y;
newXsize = newXsize - posX;
newYsize = newYsize - posY;
if (newXsize >= maximumXsize) newXsize = maximumXsize;
if (newYsize >= maximumYsize) newYsize = maximumYsize;
if (newXsize <= minimumXsize) newXsize = minimumXsize;
if (newYsize <= minimumYsize) newYsize = minimumYsize;
eval("document."+which+".width=newXsize");
eval("document."+which+".height=newYsize");

}



Any help would be appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top