Page 1 sur 1

IsNewDoc

MessagePublié: 02 Nov 2006 à 18:26
par oguruma
[syntax="javascript"]function isNewDoc(){
url = window.location.toString().toLowerCase();
if (url.indexOf("openform") < 0) {
return false;
}
else {
return true;
}
}

function isDocBeingEdited(){
if (isNewDoc()) {
return true;
}

url = window.location.toString().toLowerCase();
if (url.indexOf("editdocument") < 0) {
return false;
}
else {
return true;
}
}[/syntax]


http://searchdomino.techtarget.com/tip/ ... 84,00.html

pas bête la méthode... il fallait juste y penser

MessagePublié: 02 Nov 2006 à 18:43
par oguruma
[syntax="javascript"]var form = document.forms[0];
var temp = form.method;
if (temp.toLowerCase() === 'post') { //do stuff
}

/*the rest is just embellished
for understanding of why Smile*/
function checkMode(){
var form = document.forms[0]
//If the method is "get" then we are in read mode
//If the method is "post" then we are in edit mode
var temp = form.method;
if (temp.toLowerCase() === 'post') { //We use toLowerCase because the NS6 browser returns 'Post' - uppercase P
alert('Edit Mode');
}
else {
alert('Read Mode');
}
}[/syntax]



même source