todm Posted June 22, 2008 Share Posted June 22, 2008 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 https://forums.phpfreaks.com/topic/111303-solved-cant-get-a-select-box-to-update/ Share on other sites More sharing options...
todm Posted June 22, 2008 Author Share Posted June 22, 2008 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 https://forums.phpfreaks.com/topic/111303-solved-cant-get-a-select-box-to-update/#findComment-571855 Share on other sites More sharing options...
todm Posted June 23, 2008 Author Share Posted June 23, 2008 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 https://forums.phpfreaks.com/topic/111303-solved-cant-get-a-select-box-to-update/#findComment-571863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.