webForumDet fria alternativet

Ett nytt försök

5 svar · 232 visningar · startad av bluespot

bluespotMedlem sedan nov. 200093 inlägg
#1

Min fråga var:

Jag har ett formulär:
<form action="http:/www.whatever.se/nr=" method="post" name="Inloggning">
<input name="Nr" type="text">
<input type="submit" name="Submit" value="Submit">
</form>

I textrutan skrivs ett värde in (tex 1170)

Då ska adressen bli:
http:/www.whatever.se/nr=1170

Svaret jag fick:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function url(){
input = document.Inloggning.Nr.value
location.href = "http:/www.whatever.se/nr="+input
}
//-->
</script>
</head>

<body>
<form action="http:/www.whatever.se/nr=" method="post" name="Inloggning" onSubmit="url()">
<input name="Nr" type="text">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

men jag länkas bara till den adress som står i action-taggen, javascriptet verkar inte användas. någon?

colioneMedlem sedan juni 20014 421 inlägg
#2

Bliff, bloff, blaff:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>Untitled</title> 
<script language="JavaScript" type="text/javascript"> 
<!-- 
function url(){ 
input = document.Inloggning.Nr.value 
document.form[0].action = "http:/www.whatever.se/nr="+input 
} 
//--> 
</script> 
</head> 

<body> 
<form method="post" name="Inloggning" onSubmit="url()"> 
<input name="Nr" type="text"> 
<input type="submit" name="Submit" value="Submit"> 
</form> 
</body> 
</html>
bluespotMedlem sedan nov. 200093 inlägg
#3

Nej det funkar inte.

colioneMedlem sedan juni 20014 421 inlägg
#4

Om vi provar såhär då:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>Untitled</title> 
<script language="JavaScript" type="text/javascript"> 
<!-- 
function url(){ 
input = document.Inloggning.Nr.value 
document.Inloggning.action = "http:/www.whatever.se/nr="+input 
document.Inloggning.submit()
} 
//--> 
</script> 
</head> 

<body> 
<form method="post" name="Inloggning"> 
<input name="Nr" type="text"> 
<input type="button" name="Submit" value="Submit" onclick="url()"> 
</form> 
</body> 
</html>
Jesper TMedlem sedan nov. 20017 144 inlägg
#5

ELLER:

<script language="JavaScript" type="text/javascript"> 
<!-- 
function url(){ 
input = document.Inloggning.Nr.value 
document.Inloggning.action = "http://www.whatever.se?nr="+input 
} 
//--> 
</script> 

<form method="post" name="Inloggning" onSubmit="url()" target="_blank"> 
<input name="Nr" type="text"> 
<input type="submit" name="Submit" value="Submit"> 
</form>
bluespotMedlem sedan nov. 200093 inlägg
#6

Tack så mycket!!!

132 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
129 ms — hämta tråd, inlägg och bilagor (db)