Jump to content

george

Members
  • Posts

    377
  • Joined

  • Last visited

Everything posted by george

  1. I have been trying to create a page with a color gradient background using CSS: body { background-image:-moz-linear-gradient(top, #000029 50%, #000080 100%); } But when I render the page, the gradient extends only as far as the content, and then repeats to fill the screen. How can I make it so that it renders the gradient to the full browser window, regardless of the content? When I replace the body background-image attribute with a background-color attribute, it renders to the full screen, as I would expect. Perhaps this can not be done, or maybe there is a workaround?
  2. The reason it is complicated to position text using CSS is because there is a range of browsers and screen resolutions which the code may be rendered on. So the code must be written in such a way as to address all of these possibilities. In your example, centering a block vertically can only be done when you have a fixed screen height of some known value. But since one can generally scroll down a page as long as there is something to display, there is no known bottom. What I would do is provide a margin-top:20px; attribute to your body tag, or, if your text is contained in a DIV tag, provide that div tag with a margin-top value.
  3. Within script tags in the body of my HTML, I have: aRay = new Array(); aRay[0] = 'a'; aRay[1] = 'b'; aRay[2] = 'c'; aRay[3] = 'd'; aRay[4] = 'e'; document.write("aRay length is "+aRay.length+"</br>"); for( i = 0; i < aRay.length; i++ ) document.write("element "+i+" is "+aRay[i]+"</br>"); for( y = 0; y < aRay.length; y++ ) { if(aRay[y]='d') document.write("so we can find ""+aRay[y]+"" in element "+y+"</br>"); break; endif; } And what prints out is: aRay length is 5 element 0 is a element 1 is b element 2 is c element 3 is d element 4 is e so we can find "d" in element 0 That 0 at the end of the line above should be a 3. Why isn't it? What am I missing here?
  4. That was it dsonesuk. I only want to display the built string because I want to see if I made any mistakes, and sure enough, I did.
  5. Thanks dsonesuk, I will try that now.
  6. Since the content of the variable I want to echo is HTML code, maybe there is some way I need to escape it, or echo it to a variable, and then populate an innerHTML with it? I do not want the HTML I am outputting to be used by the browser as HTML on the fly. I want to display the HTML as content.
  7. Here is my code: The code fails at line 36: $txt = substr($mtcontent, 0, strpos($mtcontent, "</title>")+7); <!DOCTYPE HTML><html><head> <meta charset="utf-8"> <title>Untitled Document</title> <style type="text/css"> body { margin:20px; padding:0; background-color:#0000FF; color:#FFFF00; } </style></head><body><h3>/* make a copy of the file to parse for assurance */</h3><br><?php copy("C:UsersownerDesktopPLUcodes.htm", "C:UsersownerDesktopworkfile.htm"); if(!file_exists("C:UsersownerDesktopworkfile.htm")) { die("File not found"); } else { echo "got copy"; }?><br><h3>/* get a file handel for the workfile */</h3><br><?php $myfile = fopen("C:UsersownerDesktopworkfile.htm", "r") or die("Unable to open file!");?><h3>/* copy content of workfile into a var, $mtcontent, for parsing */</h3><br><?php $mtcontent = fread($myfile,filesize("C:UsersownerDesktopworkfile.htm"));?><h3>/* we don't need the file workfile.htm open anymore, so close it using the file handel for that file */</h3><br><?php fclose($myfile);?><h3>/* get the content of our string from the first byte up to the closing title tag */</h3><br><h3>/* well put it in a varable called $txt */</h3><br><?php $txt = substr($mtcontent, 0, strpos($mtcontent, "</title>")+7); echo $txt;?><h3>/* then add the string litteral <head><body> to the end of our string */</h3><br><h3>/* have to use the HTML code for the grater and less than symbols, else won't work */</h3><br><?php $txt .= '<head><body>'?><h3>/* lets see what we have */<h3><br><?php echo $txt;?></body></html> I have tried using strpos($mtcontent, "<⁄title>") instead of strpos($mtcontent, "</title>") But that causes the page to render strangely wrong. At the end of the page, I want to echo the variable txt, but it appears to be empty.
  8. Problem fixed, as I did change it to <div ="t1"><pre>.t1 { border-color: blue red green yellow; border-style:solid;}</pre></div> and that did correct my problem.
  9. I have a very simple jQuery line of code that is not working. $("p#t1").css("color","#ffffff"); In my document I have a P tag with an ID of t1. I have attached my entire HTML file should this be helpful. TIA My ID of t1 is not declared in my CSS. Could this be the problem? I am going to declare it now. triangle.html
  10. I have tried chaining a .stop(), a stopPropagation(), and a stopImmediatePropagation() to the end of the in-document code as follows $("a.imp").click(function(){$(this).parents("div").css('z-index','2')}).stopPropagation(); ; None of them stopped the repeating of the animation, which I want to run only on document ready.
  11. I have a page with some jQuery on it. In the header, I have <script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script><script> $(document).ready(function(e) { $("div.box").each(function ( i) { var div = $(this); setTimeout(function () { div.fadeIn(800); }, i * 800) }); });</script> And within the document body itself I have <script> $("a.imp").click(function(){$(this).parents("div").css('z-index','2')}); </script> Both functions do as I want, but the script that is within the document presents it's result real briefly, and then the automation generated in the header section runs again. How can I make it stop? I want one thing to run on document load, and the other thing to run when the client clicks an anchor tag. But they both run when I click the anchor tag.
  12. I am attempting to fade in 8 images, one at a time with a delay between each one. I have used the following code. /* I have 8 <div>s, named "one", "two", "tre" ... etc.. */ var divs = ["one", "two", "tre", "for", "fiv", "six", "svn", "egt"];/* initially these divs all have an attribute of display:none I step through each elemet in the "divs" array, I take the litteral "div#, and append to it the value of the current array element, and pass this value to the slowShow function. */ for (var i=0;i<divs.length;i++) { setTimeout(slowShow("div#"+divs[i]), 555555); }; /* the function slowShow calls a jQuery function using the value passed to that function as the selector for the jQuery function */ function slowShow(param) { $(param).fadeIn( 2400 ); };/* the snipit of code displays the 8 individual divs all at once, though they all use the fadeIn value of 2400 */ The entire page code is attached, but the images are not. Please note, Initially a class was used to give all divs the attribute of display:none. All divs had that class, plus a unique identifier. I was hoping that by using the ID as the jQuery selector, I might be able to display each div individually, one by one. But they all display at once, as though I was using the class in my selector. I already tried placing a display:none attribute in each unique div identifier. That didn't help, so I changed it back to using a class to set all the divs to display:none.
  13. I have eight instances where I adjust the CSS using jQuery. Six of them work just fine. Two of them don't work at all. Lines 151 and 159 do not alter the CSS as they are suppose to. Looking at the file, I process all eight triangles using the same syntax. Hovering over a triangle hilights that triangle, and highlihghts the syntax that builds it. The top-left and the bottom-right triangles do not change color on hover. The other six triangles and corresponding text highlight just fine. Here is link to the site. I have also attached a copy. So far, I have attempted changing the id of the particular element to another name, thinking it may be a reserved word problem. I have also combed the code for syntax errors, but have not found any. I am using jquery-1.8.3.min.js . Please help.
  14. It takes the same path each time. I had thought that by incrementing the value of $_COOKIE['MyCookie'] that would do it. But I needed to reset the cookie to it's new value. Thanks again. You guys are the greatest.
  15. Oh my, You are right! Moved them, testing . . ., Okay, now it increments the first time, but not after the first time. I need it to increment every time. Thanks
  16. In the example given, line 6 echo (isset($_POST['slctn']))?"Post set to ".$_POST['slctn']:"post not set "; will echo "post not set" if the $_POST['slctn'] is not set. If it is set, it will echo "Post set to ", and it will echo its value. This method is more specific than var_dump. I also check the value of $_POST['slctn'] again in the switch statement.
  17. @justsomeguy, removed semicolon. Original problem persists. @thescientist, the 6th line of code checks to see if the post has been set, and if so, echo's it's value. The value is not being set. Don't know why.
  18. Not sure if I should post this in jQuery or php, as both languages are being used. The objective is to change the value of a cookie based on which button is pressed. In the code I have now, the posted value is not being received by the php script. <?php if (!isset($_COOKIE['MyCookie'])); setcookie('MyCookie',0);$i = 0;echo (isset($_POST['slctn']))?"Post set to ".$_POST['slctn']:"post not set ";if (isset($_POST['slctn'])) { echo $_POST['slctn']; switch ($_POST['slctn']) { case "prev": echo "Pressed Prev button"; break; --$_COOKIE['MyCookie']; case "save": echo "Pressed Save button"; break; case "next": echo "Pressed Next button"; break; ++$_COOKIE['MyCookie']; } $i = $_COOKIE['MyCookie'];}echo " $i";?><!DOCTYPE HTML><html><head> <meta charset="utf-8"> <title>Cookie test</title> <script type="text/javascript" src="jquery-1.10.2.min.js"></script> <script type="text/javascript"> $( document ).ready(function() { $("input#prev").click(function() { packet = this.id; $.post('CookieTest.php', 'slctn=' + packet, function (response) { $("#dbline").html(response); alert('prev'); }); }); $("input#next").click(function() { packet = this.id; $.post('CookieTest.php', 'slctn=' + packet, function (response) { $("#dbline").html(response); alert('next'); }); }); }); </script></head><body> <br> <br> <br> <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post"> <label for="selection">Make selction </label> <input id='selection' name='selection' value="Primary Selection Made"><br> <input type="button" value="Prev" name="prev" id="prev"> <input type="button" value="Save" name="save" id="save"> <input type="button" value="Next" name="next" id="next"> </form></body></html>
  19. george

    Create a table

    I did as you suggested, deleting my ``'s for blank values, and removing them altoghter ErrorSQL query: INSERT INTO `phpArrayFunctions` ( `Function_Name` , `Description` )VALUES (`array_change_key_case` , `Changes all keys in an array`); MySQL said: #1054 - Unknown column 'array_change_key_case' in 'field list'
  20. george

    Create a table

    Okay, I created the table using phpAdmin, and then tried to import one row of data. Error. INSERT INTO 'phpArrayFunctions'('increment','Function_Name','Description','Constants_Used','Arguments','Return_Value','Brief_Example','Detailed Example','Times_Pass') VALUES (,'array_change_key_case','Changes all keys in an array',,,,,,); I have tried several variations of this, using quotes, then using quotes for the null values. I always get an error. phpAdmin does give an error number. Is there somewhere that I can look up this error? The error discription is not helpful.
  21. george

    Create a table

    What I have is DROP TABLE IF EXISTS phpArrayFunctions;CREATE TABLE IF NOT EXISTS phpArrayFunctions ( 'increment' int(11) NOT NULL AUTO_INCREMENT, 'Function_Name' varchar(30) NOT NULL, 'Description' varchar(250) default NULL, 'Constants_Used' TINYTEXT default NULL, 'Arguments' TINYTEXT default NULL, 'Return_Value' TINYTEXT default NULL, 'Brief_Example' TEXT default NULL, 'Detailed Example' LONGTEXT default NULL, 'Pass_Fail' boolean default false, 'Times_Pass' int(11) default 0, PRIMARY KEY ('Increment')) ENGINE=MyISAM DEFAULT CHARSET=latin1; I can not find the error.
×
×
  • Create New...