Hello every one, i am new here so i would appreciate any help wit this.
i am trying to call a url using javascript in an html select statement as follows;

echo "<select>";
for ($i = 0; $i < $pages; $i++) {
?>
<option value=''
onClick='javascript:window.location.href= "index.php?option=<?php echo $option; ?>&task=view&limit=<?php echo $lmt * $i; ?>&id=<?php echo $idpik; ?>&Itemid=<?php echo $Itemid; ?>"'><?php echo $i; ?></option>
<?php
}

echo "</select>";
however, this works in other browsers except IE6. please help me out. thank you. i luv this forum already

Recommended Answers

All 4 Replies

here is how i would do it

echo '<select onchange="javascript:window.location.href=this.value">';
for ( $i=0,$i<$pages,$i++ ) {
	echo "<option value=\"index.php?option={$option}&task=view&limit=". $lmt * $i . "&id={$idpik}&Itemid={$Itemid}\">{$i}</option>";
}
echo '</select>';
commented: very succinct, clipped and put in my 'usefull stuff' file +1

Thanx alot, @kkeith29 this works perfect in both FF and IE6.
i luv this site.
i have another problem though. this code below works in FF but not in IE.

<option value='district' onClick='javascript:javaFunctiondistrict();'>district</option>

any help will be appreciated. thanx again @kkeith29, you have made my day.

is this in the same form?

also, is that the only value that needs to call that function for is there a function for each option.

yes there is a function for each option.
no its not in the same form. here is the whole select statement

<select name='field_general' size='1' class='inputbox' id='field_city'>
			<option value='allgene'>...select...</option>
	
			<option value='district' onClick='javascript:javaFunctiondistrict();'>district</option>
			
			<option value='gender' onClick='javascript:javaFunctiongender();'>Gender</option>
			<option value='status' onClick='javascript:javaFunctionstatus();'>status</option>
			<option value='type' onClick='javascript:javaFunctiontype();'>type</option>
			</select>

and here is one of the functions;

function javaFunctionschool(){
			 
var url="index.php?option=com_artband&Itemid=73?action=phpFunctionSchool";
	   window.open(url, "_self");
	  
	  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.