herghost Posted September 26, 2010 Share Posted September 26, 2010 Hi everyone, Can anyone give me any pointers towards how to create a form like the listing add one on ebay? Basically the form fields are displayed depending on what type of product you have, I basically need something very similar where I have multiply categories but wish to have different inputs for each type? Many thanks Link to comment https://forums.phpfreaks.com/topic/214469-ebay-type-form/ Share on other sites More sharing options...
BlueSkyIS Posted September 26, 2010 Share Posted September 26, 2010 Javascript: Hide/display DIV's based on selections, using the onchange(), onclick() and/or other JS handlers. Link to comment https://forums.phpfreaks.com/topic/214469-ebay-type-form/#findComment-1116028 Share on other sites More sharing options...
herghost Posted September 26, 2010 Author Share Posted September 26, 2010 Thanks BlueSkyIS, looks like I have some reading to do! Link to comment https://forums.phpfreaks.com/topic/214469-ebay-type-form/#findComment-1116030 Share on other sites More sharing options...
herghost Posted September 26, 2010 Author Share Posted September 26, 2010 Ok, this is what I have found online and am trying to edit to my own needs: <html> <head> <title></title> <script type="text/javascript"> var cats = ["electronics", "entertainment", "homeandgarden", "finance", "motoring", "fashion", "travel", "medical",]; var electronics = ["mobiles", "hi-fi"]; var entertainment = ["books", "dvds",]; function visiblox(arrDiv, hs) { var disp = (hs) ? "none" : "block"; for(var x = 0; x < arrDiv.length; x++) { document.getElementById(arrDiv[x]).style.display = disp; } } function chk(what, item) { if(item) { visiblox(what, false); } else { visiblox(what, true); } } </script> <style type="text/css"> <!-- .hide { display: block; } .hide { display: none; } --> </style> </head> <body> <img src="images/electronics.png" onClick="chk(electronics, this.clicked);"> <br> <input type="checkbox" onclick="chk(entertainment, this.checked);" checked> Entertainment<br> <br> <br> <div id="mobiles" class="hide">Mobiles</div><br> <div id="hi-fi" class="hide">Hi-Fi</div><br> <div id="books" class="hide">Books</div><br> <div id="dvds" class="hide">DVD's</div><br> </body> </html> The check boxes work fine, however how would I get the image to achieve the same result? Thanks Link to comment https://forums.phpfreaks.com/topic/214469-ebay-type-form/#findComment-1116044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.