Jump to content
php.lv forumi

Recommended Posts

Posted

<html> 
<body> 
<script type="text/javascript"> 
<!-- 
var c=-1; 

function byid(id) 
{
if (document.getElementById)
 return (document.getElementById(id));
if (document.all)
 return document.all[id];
if (document.layers)
 return document.layers[id];
return false;
}

function move(dir) 
{  
 if (dir==1) 
if(c!=0) 
  c=c-1;	

 if (dir==0) 
if(c!=2) 
  c=c+1;

if (byid('hid')) 
byid('hid').value= c;

  document.getElementById('txt').innerHTML= c;
//   document.MyForm.hid.value = c;						  //nestrada ????
//   document.getElementById("hid").value = c;		//nestrada ????
} 
//--> 
</script>

<form name="MyForm" id="MyForm"> 
<input type="button" value="Back" onclick="move(1)"> 
<input type="button" value="Next" onclick="move(0)"><br />

<input id="hid" type="hidden" name="hid" value="0">
<span id="txt"></span>
</form> 

</body> 
</html>

 

Nesanak nomainit hidden vertibu,kur varetu but problema?

Posted (edited)

man uz IE 6, nekas nemainas, skatos caur viewsource

<html> 
<body> 
<script type="text/javascript"> 
<!-- 
var c=0; 

function move(dir) 
{  
 if (dir==1) 
if(c!=0) 
  c=c-1;	

 if (dir==0) 
if(c!=2) 
  c=c+1;

  document.getElementById('txt').innerHTML= c;
  document.MyForm.hid.value = c;					   

} 
//--> 
</script>
<?php 
echo $_GET['hid']
?>
<form name="MyForm" id="MyForm"> 
<input type="button" value="Back" onclick="move(1)"> 
<input type="button" value="Next" onclick="move(0)"><br />

<input id="hid" type="hidden" name="hid" value="0">
<span id="txt"></span>
<input type="submit" value="go" name="but">
</form>	 
</body> 
</html>

Sanak ka view source spiezot nemainas, toties kad submito formu, vertibu nomaina?

Edited by cucumber
Posted

Pamēģini šitam pamainīt hidden vērtību un tad submit'ot formu

<html>
<body>

<?php
print_r($_POST);
?>


<script type="text/javascript">
<!--
var c=-1;

function byid(id)
{
if (document.getElementById)
 return (document.getElementById(id));
if (document.all)
 return document.all[id];
if (document.layers)
 return document.layers[id];
return false;
}

function move(dir)
{  
 if (dir==1)
if(c!=0)
  c=c-1;	

 if (dir==0)
if(c!=2)
  c=c+1;

if (byid('hid'))
byid('hid').value= c;

  document.getElementById('txt').innerHTML= c;
//   document.MyForm.hid.value = c;						  //nestrada ????
//   document.getElementById("hid").value = c;		//nestrada ????
}
//-->
</script>

<form name="MyForm" id="MyForm" method="post">
<input type="button" value="Back" onclick="move(1)">
<input type="button" value="Next" onclick="move(0)"><br />

<input id="hid" type="hidden" name="hid" value="0">
<input type="submit" name="submit" />
<span id="txt"></span>
</form>

</body>
</html>

Posted
Laikam jau noskaidrojām, ka cucumber vienkārši domāja, ka iekš IE View Source varēs redzēt izmaiņas.

Tieshi ta. Viss strada. Paldies.

×
×
  • Create New...