I have a webpage that I display a table full of data from a database. I call this javascript function when I click on the data... in order to change the value... This redirects it back to my mainpage, where I handle adding it to the database...
function confirmCancel(id){
var d = document;
var bReply = confirm('Are you sure you want to cancel Order ' + id + '?');
if (bReply)
window.event.returnValue = false;
d.location.href = './main.aspx?action=cancel&orderid=' + id;
}
This would do completely nothing in chrome, until I added window.event.returnValue = false....
I have two other functions I would like to use them in...
function changePriority(id){
var strTemp;
var d = document;
strTemp = prompt('New Priority. Decrease the value to increase the priority','');
if (strTemp.length > 0 && strTemp.length <= 3 && !isNaN(strTemp))
d.location.href = './main.aspx?action=priority&orderid=' + id +'&priority=' + strTemp;
else
alert('Invalid Priority Value!');
}
and
function changeQuantity(id, item){
var strTemp;
strTemp = prompt('New Quantity.','');
if (strTemp.length > 0 && strTemp.length <= 3 && !isNaN(strTemp))
document.location.href = 'viewLoad.aspx?action=quantity&orderid=' + id +'&item=' + item + '&quantity=' + strTemp;
else
alert('Invalid Quantity Value!');
}
So now, when I add the window.event.return = false; to any other functions... I lose my entire javascript... So all my header/footer disappears... You dont have to look at this code... It is just there to show you how I am writing my header...
function writeHeader (title){
var d = document;
d.write("<tr>");
d.write("<td width='35%' align='left' valign='bottom' rowspan='2' nowrap class='headerText'>");
d.write("<img src='./images/mie.jpg' border='0' class='headerLogo1'></img>");
d.write("</td>");
d.write("<td width='30%' align='center' valign='top' nowrap class='headerTitle'>");
d.write(title);
d.write("</td>");
d.write("<td width='35%' align='right' valign='center' id='timetext' nowrap class='headerText'>");
d.write(writeTime());
d.write("</td>");
d.write("</tr>");
d.write("<tr>");
d.write("<td align='center' valign='bottom' id='greetingtext' nowrap class='headerText'>");
d.write(writeGreeting());
d.write("</td>");
d.write("<td align='right' valign='bottom' id='datetext' nowrap class='headerText'>");
d.write(writeDate());
d.write("</td>");
d.write("</tr>");
d.write("<tr>");
d.write("<td width='100%' align='center' valign='center' colspan='3' class='headerText'>");
d.write("<hr color='gray'>");
d.write("</td>");
d.write("</tr>");
d.write("<tr height='35'>");
d.write("<td align='left' valign='top' colspan='1' class='headerText1'>");
d.write("<button name='btnPrint' style='cursor:hand;' class='headerText1' alt='Send this page to the printer' onMouseOver='this.style.color=\"orangered\";' onMouseOut='this.style.color=\"black\";' onClick='self.print();'>Print this Page</button>");
d.write("<button name='btnEmail' style='cursor:hand;' class='headerText1' alt='Email a link to this page' onMouseOver='this.style.color=\"orangered\";' onMouseOut='this.style.color=\"black\";' onClick='location.href=\"mailto:?subject=A Link from the Component Store Web Site&body=" + escape(location.href) + "%0\A%0\D\";'>Email this Page</button>");
d.write("</td>");
d.write("<td align='center' valign='top' colspan='2' class='headerText'>");
d.write("<table width='100%' align='center' cellspacing='0' cellpadding='0' border='0'>");
d.write("<tr>");
d.write("<td width='95%' align='center' valign='center' class=''></td>");
d.write("<td align='center' valign='bottom' style='cursor:hand;' class='fontSize1' onMouseOver='this.style.color=\"orangered\";' onMouseOut='this.style.color=\"black\";' onClick='changeStyleSheet(\"smaller\")'>A</td>");
d.write("<td align='center' valign='bottom' style='cursor:hand;' class='fontSize2' onMouseOver='this.style.color=\"orangered\";' onMouseOut='this.style.color=\"black\";' onClick='changeStyleSheet(\"default\")'>A</td>");
d.write("<td align='center' valign='bottom' style='cursor:hand;' class='fontSize3' onMouseOver='this.style.color=\"orangered\";' onMouseOut='this.style.color=\"black\";' onClick='changeStyleSheet(\"larger\");'>A</td>");
d.write("</tr>");
d.write("</table>");
d.write("</td>");
d.write("</tr>");
// Get the routine started that will update the date/time.
setInterval('updateDateTime()', 1000);
}
Any ideas how to fix this issue? Either to have the javascript redirect correctly without window.event.returnvalue = false; or how to fix the issue of the javascript not writing the header/footer when I have window.event.returnvalue = false; in two functions?