Joshua F Posted September 26, 2010 Share Posted September 26, 2010 I have a drop down when you click something. It brings up Go to Page, and it has a input and a Go button. What I am trying to do is so when you type in a number, it will go to that page. How the pages load is from ?page=# Here's the code <script type='text/javascript'> //<![CDATA[ /* Templates/Language */ ipb.templates['page_jump'] = new Template("<div id='#{id}_wrap' class='ipbmenu_content'><h3 class='bar'>Jump to page</h3><form name='form' action='?page=' method='get'><input type='text' class='input_text' id='#{id}_input' size='8' name='page' value='' /> <input type='submit' value='Go' name='submit' class='input_submit add_folder' id='#{id}_submit'/></form></div>"); //]]> </script> Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/ Share on other sites More sharing options...
Adam Posted September 26, 2010 Share Posted September 26, 2010 Sorry, what's your question? Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/#findComment-1115966 Share on other sites More sharing options...
Joshua F Posted September 26, 2010 Author Share Posted September 26, 2010 How do I make it add onto the url with ?page=# Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/#findComment-1115968 Share on other sites More sharing options...
Adam Posted September 26, 2010 Share Posted September 26, 2010 You don't need to use JavaScript for this. You're actually half way their with the code in that template call; although I don't see anything about a drop-down menu. All you need to do is submit a form with the GET method, and an input with the name of parameter: <form method="get" action=""> <input type="text" name="page" /> <input type="submit" value="Jump To Page" /> </form> That'll result in a URL like "?page=value of input". Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/#findComment-1115972 Share on other sites More sharing options...
Joshua F Posted September 26, 2010 Author Share Posted September 26, 2010 I know this, but it's a button you click, and the Javascript loads, and it displays that. So I have to use Javascript. Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/#findComment-1115973 Share on other sites More sharing options...
Adam Posted September 26, 2010 Share Posted September 26, 2010 I don't see how? If you're talking about loading the content without the page refreshing, whatever way you do it, changing the URL will reload the window. If you're not on about that, I don't understand what you're trying to say. Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/#findComment-1115976 Share on other sites More sharing options...
Joshua F Posted September 26, 2010 Author Share Posted September 26, 2010 Okay, I have a little button. It uses Javascript, when you click it. It opens a little box under it says Go to Page, with a Text box and a GO button. I am tying to make it so when you click GO and you have a number typed into the box it will go to that page. Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/#findComment-1115977 Share on other sites More sharing options...
Adam Posted September 26, 2010 Share Posted September 26, 2010 Yes, and why can't that JavaScript just display a HTML form? Validation or something? Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/#findComment-1115979 Share on other sites More sharing options...
Joshua F Posted September 26, 2010 Author Share Posted September 26, 2010 I don't think it will. Here's my button and javascript code. <li class='total pagejump clickable pj0252154001'>(3 Pages) <img src='http://runelegend.com/public/style_images/deflection/dropdown.png' alt='+' /> </li> <script type='text/javascript'> //<![CDATA[ /* Templates/Language */ ipb.templates['page_jump'] = new Template("<div id='#{id}_wrap' class='ipbmenu_content'><h3 class='bar'>Jump to page</h3><form name='form' action='?page=' method='get'><input type='text' class='input_text' id='#{id}_input' size='8' name='page' value='' /> <input type='submit' value='Go' name='submit' class='input_submit add_folder' id='#{id}_submit'/></form></div>"); //]]> </script> Picture Unclicked Clicked Quote Link to comment https://forums.phpfreaks.com/topic/214407-drop-down-go-to-page/#findComment-1115986 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.