I have a question of Javascript, I don't whether anyone has experience this before, but I think some of you must have.

I have the following main form, with a field called location, in which I had used the SELECT html tag and also at the same time, the content for the location field is actually extract from a MySQL table called location.

<select name="hometown_id">
<option value="">--- Please select a hometown ---</option>
$sqlstmt = "SELECT * FROM locations ORDER BY location";
$result = mysql_query ($sqlstmt);
while ($row = mysql_fetch_object ($result)) {
<OPTION value="<?PHP echo $row->id; ?>"><?PHP echo $row->location; ?></OPTION>
<INPUT type="button" value="Manage Town List" onclick="newwindow ('managetown.php');">

This is only a portion of the main form, as you notice I have a button which will open a new window and call another script called managetown.php

In this managetown.php, you are allowed to add new locations. When adding new locations, my intention was to submit an INSERT sqlstmt and add the new location into the location table (MySQL db).
And at the same time I had also used Javascript to dynamically add the new value into the parent window by using the following javascript function.

function update_selectbox (fieldName, id, value) {
   field = opener.document.forms[0].eval (fieldName);
   new_field_elem = new Option (value, id);
   field.options[field.length] = new_field_elem;
   return true;

Now my problem is, that this will only work in Netscape 4.x and works nicely in Netscape 7.1, but unfortunately it doesn't if ran on IE.

Would appreciate if anyone could advise me why it doesn't run properly on IE.

Regards and thanks in advance.

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to