Jump to content

Actually More Of A JS Question But Includes PHP


glenelkins

Recommended Posts

Hi

 

Here is my code that calls an AJAX update function when an option is selected from <select> component:

 

<select name="publisher_id" style="width: 130px;">
    <option value="">Select Publisher</option>

        <?php

    foreach ( $publishers as $value ) {

        	?>
	<option value="<?php echo $value->ID; ?>" onClick="ShowProjects ('<?php echo $value->ID; ?>');"><?php echo $value->publisher_id; ?></option>
	<?php
    
            }

?>

</select>

 

The problem being the onClick is only working in FF ??? I tried adding onChange="ShowProjects(this.selectedIndex);"  as well but makes no difference

ah its the selectedIndex it doesnt work. If you look at my code again I dont want the ShowProjects function to take the selectedIndex I need it to take the $value->ID  ( as seen in the onClick on the options )

 

How would I accomplish this with the onChange ??? Or is there a way to allow onClick to work in ie?

That's odd that it doesn't work in IE.  Does the same call to ShowProjects() work if you call it elsewhere, such as in the body's onLoad() ?  Just to see if the compatibility issue is in how it's called, or in the function itself.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.