Jump to content

DarkxPunk

Members
  • Posts

    465
  • Joined

  • Last visited

Posts posted by DarkxPunk

  1. Figured it out, gotta use switch, if anyone can find a more compact and dynamic way of doing this let me know.

    function changePage(link){	var nav = link.innerHTML;	switch(nav)	{		case 'HOME':			location.href = 'index.php';			break;		case 'ABOUT ORMT':			location.href = 'about.php';			break;		case 'OUR RMTs':			location.href = 'rmts.php';			break;		case 'GET INVOLVED':			location.href = 'involved.php';			break;		case 'CONTACT US':			location.href = 'contact.php';			break;	}}

    The reason I need it dynamic is I want it so when any anchor is pressed instead of executing the href it will just change the location.href. Maybe it will be easier replacing all hrefs with onclick location.href = page... Idk. Thoughts?

  2. One thing I have noticed is that since I started using HTML 5 I have not really noticed as many limitations with older browsers as I thought. Why? Well because for the most part, you wont really use many of the new features within HTML 5. With Windows 8 out and Microsoft pushing people to move to it, and with android and iOS using webkit and almost all the other browsers up to date, the average person not able to support HTML 5 are big business. So write all your websites in HTML 5, get used to it cause its here to stay and majority of people are ready. But if you find limitations, its easy to solve them (even within a HTML 5 framework). Hope this helps.

  3. Its always good to look for alternatives, so good on DDs1, but I would say stop developing for IE. Develop for Safari, FireFox, Opera or Chrome. Once it looks great on one of those browsers look back and fix the bugs with IE. Doing it the other way will kill your groove because the browsers I listed actually follow the rules. Just a idea.

  4. Thank you! That was exactly right. Now to expand a little... So now that I have this understood I want to pull the correct page based upon the button clicked. I have set up an array:

    var link[] = (Object) Array('Home' => 'index.php','About ORMT' => 'about.php','Our RMTs' => 'rmts.php','Get Involved' => 'involved.php','Contact Us' => 'contact.php',);// I bet this is all wrong >.<

    Now what needs to happen is onclick compare link to the innerHTML of the buttons and then output the correct page into location.href so location.href = link. Thanks for any help. I have been playing around and can't wrap the loops around my head...

  5. Hey everyone, So I am playing around with iOS web apps and I found out that you can hide the browser top bar and bottom bar by using a cool meta tag and then saving the page to the home screen. Now awesome right? Well if you change pages it opens up the browser (thats no fun). Is it possible using JavaScript for it to change the page without opening the link? Thanks for any pointers.Peace

  6. ???? I'm not saying that you have not already researched this, but you do know about .defaultValue how it can be used to compare if value matches the default value on blur and focus events. <input type="text" value="Enter value" name="something" onblur="if(this.value == this.defaultValue || this.value == ''){this.value=this.defaultValue;}" onfocus="if(this.value == this.defaultValue){this.value=''}" >
    Actually I was too busy researching event listener :P I will defiantly give this a try, thanks.
  7. First I will preface with YES I have done my share of research, but its still blowing over my head. Now this is my goal: I want to create a function that is versatile in that I don't need multiple for each time I use it. AKA it needs to be dynamic. I have played with this in the past doing show/hide stuff, but I can't make it fit doing what I want here. So now I want a function that will take the value of a form input on focus, compare it to a var connected to a class or id then erase it, then if the focus is blurred and the inputs value is empty to fill in the text that was in the var associated to the class or id. Now I think this can be done using EventListeners, my concept is on focus (any focus) detect value, compare value in a var then clear the value. Then on blur if empty replace text with var. What I don't understand is how to get the EventListener to work, how does it detect events without being called? Do I have to loop or no? Its confusing. Thanks for any help. Let me try to explain better [Form Field - Value: Textallot - ID: textAllot] {focus} ID is textAllot, var associated with the ID textAllot has the value of 'Textallot' both the Form Value and Var Value are == so now we clear text. {blur} Form Value is empty, ID is textAllot, var associated with ID textAllot has the value of 'Textallot', replace Form Value with 'Textallot'. else if Form Value is not empty do nothing. Better?

  8. So! I think I am satisfied with my results so here is the code: HTML

      <div id="bgHeader"></div>  <div id="header">   <?php echo $qsBtn; ?>   <form id="qSearch" action="index.php" method="get">	<label>Find:</label>	<input id="qsText" type="text" name="qsInput" value="a Therapist by Name, Skill, Location" title="Start typing than hit enter" onfocus="csText(this);rePos(this)" onblur="fsText(this)">	<input id="qsImage" type="image" name="qsSubmit" title="Find" alt="Find" src="images/btnSearch.gif">   </form>   <?php echo $naviPhone ?>   <ul id="nav">	<li class="<?php echo $nHome; ?> nav stretch"><a class="stretch" href="index.php">HOME</a></li>	<li class="<?php echo $nAbout; ?> nav stretch"><a class="stretch" href="about.php">ABOUT ORMT</a></li>	<li class="<?php echo $nRMTs; ?> nav stretch"><a class="stretch" href="rmts.php">OUR RMTs</a></li>	<li class="<?php echo $nInvolved; ?> nav stretch"><a class="stretch" href="involved.php">GET INVOLVED</a></li>	<li class="<?php echo $nContact; ?> nav stretch"><a class="stretch" href="contact.php">CONTACT US</a></li>   </ul>  </div>

    CSS

    /* Header */#header,#bgHeader {padding: 10px 0 0 0;position: fixed;top: 0;left: 0;right: 0;}#bgHeader {background: url(../images/bgNav.png) repeat-x;width: 100%;height: 60px;}#wrap,#header {width: 980px;}

    JS

    function rePos(sfield){var yPos = window.pageYOffset || document.documentElement.scollTop;setTimeout(function() {window.scrollTo(0, yPos);},0);}

    Thats the basics, its not complete obviously but you can get the hint. If you would like a little assistance/walkthrough let me know and I will make a sample for yall. Peace!

  9. Are you making my point for me? Aside from that, you didn't show us your updated code or what you had tried, so there was no way of knowing what you knew or didn't know. Nothing like, "I tried this, but it does this", or "doing this only results in that", etc. It seemed like you were just looking for pointers, and not everyone has had to do what you're doing. So, providing references was a start for those of us who don't have the actual answer, but just wanted to help. If you've ever been to stackoverflow, you'll understand why they have recommended guidelines for how to ask questions, because the community there wants to encourage people trying and doing some initial research on their own, providing code samples, and reporting on what they been able to achieve (or not achieve) with what they've tried. While it's not as competitive here, it doesn't mean people should be less responsible for initiating their own interest in what they're trying to do. I helped you with honest answers and resources before. Don't get all bent out of shape over one link to some google help. If I really wanted to be condescending, I would have done this.http://lmgtfy.com/?q...ates+javascript
    My bending is in regards to the fact that some people don't want to search cause they (I hope) feel they have a community here that is willing the help, and I agree that people should try, and I have which is why then I come here because I rather get community help than search for endless hours on google. If people are not trying, and people are just leeching it's obvious, and I would have hoped it be obvious I am not one.Anyway thanks for all the help peoples.
  10. Best way is a little simple PHP. This was what introduced me to php, and if your going to get heavy into coding learn PHP and js, etc.Create a HTML file with your nav bar, and in place of your navbar in the pages put <?php include"nav.html";?> all your pages must now be labeled as .phpGood luck

    • Like 1
  11. Very funny. I would like to mention the reason people come to forums is they have either already searched or they are looking for a answer without searching, just being condescending is not polite. Now I did end up finding it and I did end up solving it.
    function rePos(sfield){var yPos = window.pageYOffset || document.documentElement.scollTop;setTimeout(function() {window.scrollTo(0, yPos);},0);}

    You call it on focus. Winning! Now problems arise, in landscape mode the page scrolls up right after page load and it hides under the URL bar for a unnecessary amount of time. Now I found a way to counteract it last night, but forgot I will keep searching. If anyone has ideas let me know. Thanks everyone.

  12. Please post your code.
    No code.
    I don't believe there is any code. He's asking what kind of code he needs and I actually don't see a starting point in this case.The question here involves overriding a browser feature. Since I don't have the browser to test, I can know if this feature can be overridden or not. All that can be done is experimenting.
    Exactly... One thing about Apple is they follow standards when it comes to web development, so I am assuming what is happening with the browser is as soon as a field is placed into focus it uses code to call up the keyboard than JS/jQuery to center the page in the available space. I have researched this a bit but everyone wants to use jQuery. What needs to happen is after x amount of seconds the page scrolls to x0 y0. So JS should be able to do this, but how to detect the action and execute the delay. Any help is appriciated. Thanks in advance! :)
  13. Hey everyone, So anyone who programs for iOS or has an iOS device will notice when a form field gets focused and the keyboard loads up it centers that field, sometimes causing unwanted visuals. How can we counteract that? There is one catch, no JQUERY!. I want to completely understand JS before I go to jQuery so please oblige. Thanks! **************Look at the bottom for the results**************

×
×
  • Create New...