HighDots Forums  

Cambiare la action di una form

Javascript (Italian) Il linguaggio JavaScript (it.comp.lang.javascript)


Discuss Cambiare la action di una form in the Javascript (Italian) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
APaella
 
Posts: n/a

Default Cambiare la action di una form - 02-04-2004 , 01:27 PM






Ho due pulsanti, se premo il primo mi fa la submit tramite post ed è tutto
ok.

Avrei bisogno che tramite il secondo pulsante di cambiare il target in
"_blank" e la action in un'altra pagina...

con questo mi fa solo il _blank e mi dice che action (anche togliendo il
value) non è supportato dall'oggetto...

document.getElementById('genera').target='_blank';
document.getElementById('genera').action.value='de faultEXCEL.asp';
document.getElementById('genera').submit();
document.getElementById('genera').target='_self';
document.getElementById('genera').action.value='de fault.asp';


suggerimenti?



Reply With Quote
  #2  
Old   
-Ema-
 
Posts: n/a

Default Re: Cambiare la action di una form - 02-04-2004 , 05:05 PM






On Wed, 4 Feb 2004 19:27:00 +0100, APaella wrote:

Quote:
Ho due pulsanti, se premo il primo mi fa la submit tramite post ed è tutto
ok.

Avrei bisogno che tramite il secondo pulsante di cambiare il target in
"_blank" e la action in un'altra pagina...

con questo mi fa solo il _blank e mi dice che action (anche togliendo il
value) non è supportato dall'oggetto...

// immagino che "genera" sia l'id del form
var form = document.getElementById('genera');
form.target = '_blank';
form.action = 'defaultEXCEL.asp';
form.submit();
// vedi http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-74049184

Ciao.
-Ema-


Reply With Quote
  #3  
Old   
APaella
 
Posts: n/a

Default Re: Cambiare la action di una form - 02-04-2004 , 07:35 PM



"-Ema-" <a@b.ccc> wrote

Quote:
// immagino che "genera" sia l'id del form
var form = document.getElementById('genera');
form.target = '_blank';
form.action = 'defaultEXCEL.asp';
form.submit();
che è esattamente quello che ho postato... ma non funzia! (anche senza value
come ho già scritto)

cmq grazie




Reply With Quote
  #4  
Old   
-Ema-
 
Posts: n/a

Default Re: Cambiare la action di una form - 02-05-2004 , 02:33 AM



On Thu, 5 Feb 2004 01:35:53 +0100, APaella wrote:

Quote:
"-Ema-" <a@b.ccc> wrote in message
news:2jhxsgml84cx$.1a46ju54lefsq$.dlg (AT) 40tude (DOT) net...
// immagino che "genera" sia l'id del form
var form = document.getElementById('genera');
form.target = '_blank';
form.action = 'defaultEXCEL.asp';
form.submit();

che è esattamente quello che ho postato... ma non funzia! (anche senza value
come ho già scritto)

posta:
1. il tag <form ... >
2. il tab <input type="button" ...
3. lo script javascript

esattamente come sono nella tua pagina.

ciao.
-Ema-


Reply With Quote
  #5  
Old   
ZER0
 
Posts: n/a

Default Re: Cambiare la action di una form - 02-05-2004 , 03:34 AM



On Wed, 4 Feb 2004 19:27:00 +0100, APaella wrote:

Quote:
con questo mi fa solo il _blank e mi dice che action (anche togliendo il
value) non è supportato dall'oggetto...
Allora, evidentemente, non e' un elemento FORM, quello che referenzi.
Posta il codice HTML relativo.

Per quanto riguarda la gestione degli elementi form, io ti consiglio di
usare ancora l'attributo name. Quindi se il tuo form ha ID uguale a
"genera" e NAME uguale a "genera":

var f=document.forms["genera"];
f.target='..';
f.action='..';
f.submit();

Quote:
suggerimenti?
Si, nel tuo codice fai un:

var el=document.getElementById("genera");

alert(el.tagName);

E vedi un po' che elemento ti ritorna, cosi' vedi se e' un elemento form o
meno.


--
C'ya,
ZER0 :: coder.gfxer.webDesigner();

"When you have eliminated the impossible, whatever remains,
however improbable, must be the truth." (S.H.)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.