Jump to content

[SOLVED] can't get a select box to update


todm

Recommended Posts

Pictures.php has a form with 4 different select boxes.  The select boxes update a div (pictsdisp.php).  The first 3 select boxes work fine.  I'm having a hell of a time with the 4th. 

 

I need to get the div area (pictsdisp.php) to update options in the 4th select box.  Then, that 4th select box would need to modify the div (if it's changed).

 

Basically, I need to figure out how to get the div area to call a javascript function.  This is what I'm trying...

print "<script language=\"JavaScript\">\n";
print "<!--\n";
print "fnPageNavigation(" . $pageNum . "," . $numberOfPages . ");\n";
print "-->\n";
print "</script>\n";

 

(fnPageNavigation is a function within pictures.js, which is loaded in the header)

 

If I add a new select box to the div area, I am able to get that to update the 4th select box.  However, I want that box to be updated without any user interaction.

 

 

Any suggestions?  I'm pretty new to Javascript & AJAX.

Link to comment
Share on other sites

Trying to clarify...

 

If I add a submit button with an "onblur" calling the function, it does what I want it to.  However, I don't want users to have to do that...  I would like the function to be called every time that page is loaded.

 

Again, the code below works, but I want to replace the button so the script is always called.

<input name="pageNav" id="id" type="submit" value="value" onblur="fnPageNavigation($pageNum, $numberOfPages)">

 

Link to comment
Share on other sites

Ah ha!  I got it.  Adding a blank image with onload seems to do the trick...

 

<img src="../images/layout/1pxBLK.gif" alt="" width="1" height="1" border="0" onload="fnPageNavigation($pageNum, $numberOfPages)">

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.