thewooleymammoth Posted October 29, 2008 Share Posted October 29, 2008 kinda hard to explain what im looking for so far i have a loop while ($num < 1000) { if ($condition == $rightcondition) { echo "need page to focus here on load<br>"; } else { echo "other text<br>"; } can anyone tell me the html that would do that? perhaps some sortof of <pagefocus> </pagefocus>???? Quote Link to comment Share on other sites More sharing options...
dropfaith Posted October 29, 2008 Share Posted October 29, 2008 sounds like a javascript issue to me http://codingforums.com/archive/index.php?t-71808.html Quote Link to comment Share on other sites More sharing options...
haku Posted October 30, 2008 Share Posted October 30, 2008 Javascript it is. HTML doesn't have logic based commands, meaning you can't use if/else or while statements in it. It also doesn't have any focus commands, or really any interactivity at all, it's purely for content. Or should be - some people use it wrong and build markup into their html. But that's a side point. Quote Link to comment Share on other sites More sharing options...
thewooleymammoth Posted October 30, 2008 Author Share Posted October 30, 2008 so i should use js? i know this isnt the right forum but the link you posted is down, any way you could tell me the js code to move to that part of the page when the user loads the page? thanks ill keep searching but i cant find it Quote Link to comment Share on other sites More sharing options...
thewooleymammoth Posted October 30, 2008 Author Share Posted October 30, 2008 nvm i just posted a new topic there, thanks for the help Quote Link to comment Share on other sites More sharing options...
haku Posted October 30, 2008 Share Posted October 30, 2008 Give the input an id: <input type="text" id="target" name="name" /> Then you can use this javascript in the head of your document: <script type="text/javascript"> window.onload = function() { document.getElementById("target").focus } </script> If that doesn't work, then post the relevant code. Quote Link to comment Share on other sites More sharing options...
thewooleymammoth Posted October 30, 2008 Author Share Posted October 30, 2008 its not a feild i want to focus on its an image that i would like to appear at the top of the screen, so should i use <img src='whatever.jpg' id='target'><br> or should i use a hidden field type? the relevant code is a page with 147 lines but ill write a more detailed code foreach ($list_of_images as $image) { $selectimage=$_GET['image']; if ($image == $selectimage) { //i want the the page to automatically load with this at the top of the screen becuase there could potentially be a huge list of images and scrolling down each time gets annoying echo " <img src='$image'><br>need page to focus here on load<br>"; } else { echo "<a href='image.php?image='$image'>other image titles<br>"; } } here is an example page http://fatalinjury.org/vf.php?name=5wooley4@gmail.com Quote Link to comment 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.