...

View Full Version : DHTML Unwanted Scrolling FF5, IE (all), Chrome, Safari



harrierdh
07-26-2011, 02:06 PM
Scroll down to the bottom. Click on an "X" button to bring up a DHTML popup. Select an item. When the DHTML closes and the original HTML is updated the browser scrolls to top. Is there a way to stop this by wrapping it somehow in a container, since you can't stop the scroll event?

<html>
<head>
<title> Vendor Management</title>
</head>
<body>
<table border="0" width="100%">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
<img src=""/>
</td>
<td><img src=""/></td>
</tr>
<tr>
<td align="left" valign="top">
<a href=""/></a>
<a href=""/></a>
<a href=""/></a>
</td>
<td align="left">
<img src=""/>
</td>
<td>
<img src=""/>
</td>
</tr>
<tr>
<td>
<span class="pageHeading" align="left">
Web Administrator
</span>
</td>
</tr>
</table>
<br/>
<form name="form" method="post" action="">
<table width="100%">
<tr>
<td width="5%"></td>
<td align="left">
<p class="filter">
All<br/>
All<br/>
</p>
</td>
<td>
<table width="40%" border="1" >
<tr>
<td class="h" colspan="2">Color Key </td>
</tr>
<tr>
<td class="S "> </td><td class="small">The is being negotiated. The administrator may finalize the when it is complete.</td>
</tr>
<tr>
<td class="SAVA">Awaiting Vendor Approval </td><td class="small">The has been finalized and is waiting for the Vendor to sign it.</td>
</tr>
<tr>
<td class="SLocked">Locked</td><td class="small">The has been finalized and signed. All the Locked items in the will be in the show.</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<table align="center">
<tr>
<td>Search:</td>
<td>
<input name="searchValue" id = "searchValue" type="text" size="24" value="">
</td>
<td>
By
</td>
<td>
<select name="searchColumn" id="searchColumn">
<option value="VENDOR_NAME" SELECTED> Vendor Name</option>
<option value="VENDOR_NUMBER" > Vendor Number</option>
</select>
</td>
<td>
And
</td>
<td>
<select name="searchQualifier" id="searchQualifier">
<option value="CONTAINS" SELECTED>Contains</option>
<option value="STARTS_WITH" >Starts With</option>
<option value="ENDS_WITH" >Ends With</option>
</select>
</td>
<td>
<input type="button" name="SearchButton" id="SearchButton" value="Search" onClick="onVendorSearch()">
</td>
<td>
<input type="button" name="ClearSearchButton" id="ClearSearchButton" value="Clear" onClick="onVendorClear()">
</td>
</tr>
</table>
</td>
</table>
<table width="90%" align="center" >
<tr align="center">
<td colspan="3">
<br>
<input name="reference" type="hidden" value="viewVendorUsersCheck">
<input name="action" type="hidden" value="delete">
</td>
</tr>
</table>
<table id="results" width="100%" border="1" style="border-color:black" align="left">
<!-- START OF DATA -->
<tr class="S ">
<td> <a name="">005890</a></td>
<td> Ivy-Dry, Inc</td>
<td> </td>
<td> </td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_005890"
name="vendorBooth_005890"

readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_005890"
id="vendorBoothBtn_005890"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>
<a href=""> </a>
</td>
<td>8</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20141</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="006867">006867</a></td>
<td> Pacific World Corporation</td>
<td> </td>
<td> </td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_006867"
name="vendorBooth_006867"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_006867"
id="vendorBoothBtn_006867"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20154</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">006952</a></td>
<td> Prince Of Peace Enterprises</td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_006952"
name="vendorBooth_006952"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_006952"
id="vendorBoothBtn_006952"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20155</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">006996</a></td>
<td> Bayer , Division</td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_006996"
name="vendorBooth_006996"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_006996"
id="vendorBoothBtn_006996"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>21</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20156</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007003</a></td>
<td> Kerr Group, Inc. / Kerr </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007003"
name="vendorBooth_007003"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007003"
id="vendorBoothBtn_007003"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>92</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20157</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007010</a></td>
<td> Unilever</td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007010"
name="vendorBooth_007010"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007010"
id="vendorBoothBtn_007010"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>160</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20158</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007057</a></td>
<td> Pfizer </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007057"
name="vendorBooth_007057"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007057"
id="vendorBoothBtn_007057"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>9</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20159</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007060</a></td>
<td> Johnson & </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007060"
name="vendorBooth_007060"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007060"
id="vendorBoothBtn_007060"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>71</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20160</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007112</a></td>
<td> Colgate-Palmolive </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007112"
name="vendorBooth_007112"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007112"
id="vendorBoothBtn_007112"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>39</td>
<td>0</td>
<td>0</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007120</a></td>
<td> W.F. Young, </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007120"
name="vendorBooth_007120"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007120"
id="vendorBoothBtn_007120"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20162</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007120</a></td>
<td> W.F. Young, </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007120"
name="vendorBooth_007120"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007120"
id="vendorBoothBtn_007120"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>
<a href=""> </a>
</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20162</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007120</a></td>
<td> W.F. Young, </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007120"
name="vendorBooth_007120"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007120"
id="vendorBoothBtn_007120"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20162</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007120</a></td>
<td> W.F. Young, </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007120"
name="vendorBooth_007120"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007120"
id="vendorBoothBtn_007120"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>
</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
<td></td>
<td>
</td>
<td>
</td>
<td> </td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="">007167</a></td>
<td> 3M </td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_007167"
name="vendorBooth_007167"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_007167"
id="vendorBoothBtn_007167"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>0</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20163</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="S ">
<td> <a name="008877">008877</a></td>
<td> x Brands</td>
<td></td>
<td></td>
<td>
<table>
<tr>
<td>
<input type="text"
id="vendorBooth_008877"
name="vendorBooth_008877"
readonly
title="" />
</td>
<td>
<input type="button"
value="X"
name="vendorBoothBtn_008877"
id="vendorBoothBtn_008877"
onclick="DCCshowBoothList(this.id)"
</td>
</tr>
</table>
<td>3</td>
<td>0</td>
<td>0</td>
<td></td>
<td>20168</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr align="center" bgcolor="9999FF" class="e">
<td></td>
</tr>
<tr bgcolor="9999FF" class="h">
<td colspan="11" class="h"> Vendor Users and s: </td>
<td class="h" align="center"><input type="submit" name="Submit" value="Submit"></td>
<td colspan="4" class="h"></td>
</tr>
</table>
<script type="text/javascript">
window.onload = function () {
DCCinitPage();
};
function DCCinitPage() {
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = DCCmousePosition;
}
function DCCmousePosition(e) {
var IE = document.all?true:false;
var tempX = 0;
var tempY = 0;
if (IE) {
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
} else {
tempX = e.pageX;
tempY = e.pageY;
}
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}
DCCmouse.setLeft(tempX);
DCCmouse.setTop(tempY);
return true;
}
function DCCmouseClass() {
this.left = 0;
this.top = 0;
this.setLeft = function (left) { this.left = left; }
this.getLeft = function() { return this.left; }
this.setTop = function (top) { this.top = top; }
this.getTop = function() { return this.top; }
}
var DCCmouse = new DCCmouseClass();
function DCCshowBoothList(thisId) {
var indexOfNumber = thisId.indexOf("vendorBoothBtn_");
var thisNumber = thisId.substring(indexOfNumber + 15);
document.forms[0].tempVendorNumber.value = thisNumber;
document.getElementById("DCCboothList").style.top = (DCCgetWindowTop() + 20) + "px";
document.getElementById("DCCboothList").style.left = (DCCmouse.getLeft() + 15) + "px";
document.getElementById("DCCboothList").style.display="";
}
function DCCcloseBoothList() {
document.getElementById("DCCboothList").style.display="none";
}
function DCCboothSelected(boothId) {
document.getElementById("DCCboothList").style.display="none";
var indexOfNumber = boothId.indexOf("boothNumber_");
var indexOfIndex = boothId.indexOf("index_");
var indexOfName = boothId.indexOf("name_");
var boothNumber = boothId.substring(indexOfNumber + 12, indexOfIndex);
var boothIndex = boothId.substring(indexOfIndex + 6, indexOfName);
var boothName = boothId.substring(indexOfName + 5);
var vendorNumber = document.getElementById("tempVendorNumber").value;
var displayBoothNumber = "vendorBooth_" + vendorNumber;
document.getElementById(displayBoothNumber).value = boothNumber;
document.getElementById(displayBoothNumber).name = displayBoothNumber + "_dirty";
document.getElementById(displayBoothNumber).title = boothName;
}
function DCCgetWindowTop() {
var winTop = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
winTop = window.pageYOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
winTop = document.body.scrollTop;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
winTop = document.documentElement.scrollTop;
}
return winTop;
}
function DCCgetWindowLeft() {
var winLeft = 0;
if( typeof( window.pageXOffset ) == 'number' ) {
winLeft = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
winLeft = document.body.scrollLeft;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
winLeft = document.documentElement.scrollLeft;
}
return winLeft;
}
</script>
<style>
.DCChiglightHover:hover {
background-color: rgb(200,200,200);
}
</style>
<div id="DCCboothList"
style="
position: absolute;
top: 200px;
left: 350px;
height: 360px;
width: 300px;
background-image: url(/DCC5/pages/shared/images/transp.gif);
display: none;
">
<input type="hidden" name="tempVendorNumber" id="tempVendorNumber" value="" />
<p align="right" style="padding: 0; margin: 0;">
<input style="height: 18px;
width: 20px;
background-image: url(dummy.gif);
border-top: 1px solid rgb(210,210,210);
border-left: 1px solid rgb(210,210,210);
border-right: 1px solid rgb(210,210,210);
border-top: 0px solid rgb(210,210,210);
color: rgb(210,0,0);"
type="button"
id="closeBoothList"
name="closeBoothList"
value ="X"
onclick="DCCcloseBoothList()" />
</p>
<div id="DCCboothListInner"
style="background: rgb(240,240,240);
border: 1px solid rgb(130,130,130);
height: 334px;
overflow: auto; ">
<p style="padding: 0; margin: 0">
<a href="" class="DCChiglightHover"
id="boothNumber_D010index_0name_Beef Booth"
style="text-decoration: none; color: black;"
onclick="DCCboothSelected(this.id)">D010Beef Booth</a>
</p>
<p style="padding: 0; margin: 0">
<a href="" class="DCChiglightHover"
id="boothNumber_D006index_1name_DCC Test Booth D006"
style="text-decoration: none; color: black;"
onclick="DCCboothSelected(this.id)">D006DCC Test Booth D006</a>
</p>
<p style="padding: 0; margin: 0">
<a href="" class="DCChiglightHover"
id="boothNumber_D005index_2name_DCC Test Booth D005"
style="text-decoration: none; color: black;"
onclick="DCCboothSelected(this.id)">D005DCC Test Booth D005</a>
</p>
<p style="padding: 0; margin: 0">
<a href="" class="DCChiglightHover"
id="boothNumber_D004index_3name_DCC Test Booth D004"
style="text-decoration: none; color: black;"
onclick="DCCboothSelected(this.id)">D004DCC Test Booth D004</a>
</p>
<p style="padding: 0; margin: 0">
<a href="" class="DCChiglightHover"
id="boothNumber_269index_92name_ARCHTECH"
style="text-decoration: none; color: black;"
onclick="DCCboothSelected(this.id)">269ARCHTECH</a>
</p>
</div>
</div>

<!-- End code for custom booth list drop down -->
</form>
</body>

</html>

NOTE:
If you are tempted to respond "validate your code" or some other useless response, save your breath. This is a real world problem. The code is an fragment output from a JSP. I don't have the luxury of updating 2000 jsp files to make it up to standard.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum