Jump to content

linuxfreakphp

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by linuxfreakphp

  1. the full code with explaining .josh: javascript code: function myajaxFunction(str, str2, number, number2) { try { var url = new String; var url = './../private/php/index.php?number='; var url2 = new String; var url2 = '&path='; var url3 = new String; var url3 = '&number2='; loadXMLDoc(url, url2, url3, str2, number, number2, function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200) { try { document.getElementById(str).innerHTML = xmlhttp.responseText; } catch(err) { error_function(err); } } }); } catch(err) { error_function(err); } } function trackv(str,number1,number2) {// number is number in the php page and number2 is number2 in the php page. try { var str2= new String; str2 = window.location.pathname; // getting the path to the php page with javasript myajaxFunction(str, str2, number1, number2); } catch(err) { error_function(err); } } html code: <!-- links to the same page but in a second language: --> <div id='c_language' class='languages' ></div> <!-- default language or chosen language by user, but this div is not doing nothing--> <div id='nc_language' class='languages' onclick='trackv("nc_language", "0","1");' ></div> <!-- my problem, sending a command to js that active the php page with ajax to switch the language, when "1" is number2 in the php and "0" is number --> <!-- links into another page in the same language: --> <div id='title_op1' class='title_op' onclick="trackv('title_op1','1','0');" >index</div> <div id='title_op2' class='title_op' onclick="trackv('title_op2','2','0');" >page2</div> <div id='title_op3' class='title_op' onclick="trackv('title_op3','3','0');" >page3</div> <div id='title_op4' class='title_op' onclick="trackv('title_op4','4','0');" >page4</div> the full php code: if($_REQUEST['number2']==1) // link to a second language to the same page. { $temp = strpos($_REQUEST['path'], 'enpath'); if($temp==true) { $path='hbpath'; } else { $path='enpath'; } echo '../' . $path . '/' . $path2; } else if($_REQUEST['number2']==0) // link another page but in the same language { $path = dirname($_REQUEST['path']); if($number == '1') { echo 'index.html'; } else if($number == '2') { echo 'page2.html'; } else if($number == '3') { echo 'page3.html'; } else { echo 'page4.html'; } } /* i have another case and that why i used "else if" and not just else when number2 is telling the php code where to go and what to do.*/ now you can see how this code is working and you can see all the code. explaining about the code and what his doing: this code allow the user to move between two languages to the same page in the other language and to another page in the same language. let say page3 to page4 in 'enpath' or move to page3 of 'hbpath'. -------------------------------------------------------------------------------------------------------- i found the problem. $temp = stripos($_REQUEST['path'], '/e/'); i told it to searched a special character as '/' in the command and it is not working. i searched in google and checked the if $temp is getting something and his not getting nothing on the site (cpanel), but when i change folder name e into 'enpath' and searched: $temp = stripos($_REQUEST['path'], 'enpath'); $temp do get value i need and the code is working cpanel real site and the localhost. how can i use special characters in text functions as i did in this case if i need to find this string or someting else with special characters??? '/e/' , '/h/' , '$?/la?/' this way failed on my server.
  2. for .josh hey i gave the php code but here is the folders and files map. site address folder: ->index.php (redirect into one of index file "h" or "e when the user enter the site using the user ip address country. this part is working only in the cpanel in real site because localhost have not country ip.) ->e (755) ->index.html ->page2.html ->page3.html ->page4.html ->h (755) ->index.html ->page2.html ->page3.html ->page4.html ->private (755) ->css (755) ->php (755) ->index.php (this is the code i have post in the message when the values are getting from index.js with ajax and i need help with him.) ->js (755) ->index.js ->img (755) now the code i post is switching languages by checking if the current page is found in "e" or "h" by checking the path of the page and redirect it into the same page but in the other language folder. $_REQUEST['path'] is sent from index.js with ajax and command: window.location.pathname (client side) to the php file (server side). on the local host the code is working great,but on the real site it is not working ok. $_REQUEST['number'] and $_REQUEST['number2'] send to index.php with $_REQUEST['path'] in the same function. for a sample let just say i'm in "nevermindthesitename/e/index.html" this code must redirect me into "sitename/h/index.html". sample with "h" if i'm located in "page2.html" inside "h" the code must redirect me into page2.html but in folder "e". for objnoob: the localhost run with apache and real site that run with apache and cpanel working with linux operating systems. for gristoi: tried what you have wrote, but it is not helping in this case.
  3. hey guys i have a problem with the next code. i wrote, but i have the same problem in this version as well. $path2 = basename($_REQUEST['path']); $number = $_REQUEST['number']; // case 1: if($_REQUEST['number2']==1) { $temp = stripos($_REQUEST['path'], '/e/'); if($temp==true) { $path='h'; } else { $path='e'; } echo '../' . $path . '/' . $path2; } now in the localhost-127.0.0.1 it is working great but in the cpanel the real site no why? php version may be? the code build to switching between languages interfaces and again it is working fine under localhost and the problem is only in the cpanel. i tried this one as well (those codes do the same thing) just to test it in the local host and the cpanel and the problem is repeating: $path2 = basename($_REQUEST['path']); $number = $_REQUEST['number']; // case 1: if($_REQUEST['number2']==1) { $temp = stripos($_REQUEST['path'], '/e/'); if($temp==true) { $path='h'; } else { $temp = stripos($_REQUEST['path'], '/h/'); if($temp==true) { $path='e'; } } echo '../' . $path . '/' . $path2; }
  4. Thanks kicken, your answer answered my question and after a addition search in Google i build what i wanted and test it on line in my site. in this site case ip tracking is better because many people in county use browsers that show "en" and not the first language of my country and that is why i chose the ip tracking and not $_SERVER['HTTP_ACCEPT_LANGUAGE'. my browser chrome gave: "en-US,en;q=0.8" my browser firefox gave: "en-US,en;q=0.5" my browser opera gave: "en-US,en;q=0.9"
  5. at this links i have a code that need to run a slider base JQuery. http://pastebin.com/CrhCDTzv i know that is not should be in the onload function, but i wanted to see the output. i also tied it as it working in the sample, but when the slider code Integrated with regular code it not working or giving an error: (included in link 1) now this is the sample that working: full code - http://pastebin.com/8SsgcqzS (no css only html and js) $(function() { $('#slides').slidesjs({ width: 1000, height: 480, start: 1, play: { active: true, // [boolean] Generate the play and stop buttons. // You cannot use your own buttons. Sorry. effect: "fade", // [string] Can be either "slide" or "fade". interval: 4000, // [number] Time spent on each slide in milliseconds. auto: true, // [boolean] Start playing the slideshow on load. swap: true, // [boolean] show/hide stop and play buttons pauseOnHover: true, // [boolean] pause a playing slideshow on hover restartDelay: 4000, // [number] restart delay on inactive slideshow } }); }); i tried to run also with $(function() { }); once html page and once in the js file (index.js once) or <script type="text/javascript"> $(document).ready(function(){ try { jquery1(); } catch (err) { error_function(err); } }); </script> in the html page the error is always showed in the chrome and the firefox can run it without any problem. i know i have missed something but i find what yet. what is the problem.
  6. meaning the data will be update when this every coin will get a new value down or up. i search in google and got only answers how to buy and sell coins, meaning trading coins all over the world only and not how to get the coins values. also how do i do that with php or js,jquery?
  7. i know i can just redirect it with jquery ,js - client side, or using php - server side, but what is the fastest way to do that when the page is loading? let say i have users from the us, uk, canada - English language, French, German, Chinese... now where is the best place to detect the ip of the country and then give the user the interface in his language? second question, if the user want to change the language with a language buttons like: English, French, German, Chinese... what is the fastest way to do that again without redirect the page to another page? client side, server side or both. i can track the ip, i can redirect the page in more than one way, but i'm looking for the fastest way and that why I'm asking this.
  8. i didn't said it work for me in firefox or chrome, but i said the opera different browser allow the code run and work and i asked why about the opera. because the opera accept it in four pc's when the firefox and the chrome didn't accept the code on this pc's. linux and windows the result was the same.
  9. sorry now i see where is my mistake now and i set it in my code, thanks jazzman1. now the firefox and chrome is working with that and also the opera, but i want to know please why did the opera worked and firefox and chrome not with my mistake? can you tell me why please? html code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="./style/style.css" /> <script src="./javascript/index.js"></script> <script src="./javascript/jquery-1.10.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ try { jquery1(); } catch (err) { error_function(err); } }); </script> </head> <body> <div id='all_divs'> <div id='master'> <div id='top'></div> <div id='title_top'> <div id='********'> <div id='***'>***</div> <div id='******'>******</div> </div> <div id='title_op' class='title_all'>Contect us</div> <div id='title_op' class='title_all'>Projects</div> <div id='title_op' class='title_all'>Info</div> <div id='title_op' class='title_all'>Home</div> </div> <div id='title_buttom'></div> <div id='slideshow'> </div> </div> </div> </body> </html> index.js try { function jquery1() { try { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: 'red' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); } catch(err) { error_function(err); } } function error_function(err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } } catch(err) { error_function(err); }
  10. your code don't show what wrong with syntax. the chrome with your code is telling me the same thing Uncaught SyntaxError: Unexpected token ILLEGAL index.xhtml:116 but i have only 79 lines of codes only. the firefox with your code is telling me the same thing as before. [17:28:02.967] SyntaxError: in strict mode code, functions may be declared only at top level or immediately within another function @ http://127.0.0.1/bla/temp39/ver6/javascript/index.js:3 [17:28:03.252] SyntaxError: Using //@ to indicate source map URL pragmas is deprecated. Use //# instead @ http://code.jquery.com/jquery-1.9.1.min.js:1 [17:28:03.252] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.252] TypeError: function a does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] TypeError: function P does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.254] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.254] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.254] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.256] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.257] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.257] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] TypeError: function In does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] TypeError: function zn does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.259] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.265] ReferenceError: reference to undefined property d.attributes[c].expando @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.265] ReferenceError: reference to undefined property b.valHooks[this] @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.270] SyntaxError: illegal character @ http://127.0.0.1/*********/index.xhtml:55 [17:28:03.304] Unknown property 'box-sizing'. Declaration dropped. @ http://127.0.0.1/*********/index.xhtml [17:28:03.305] ReferenceError: reference to undefined property b.event.triggered @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.306] ReferenceError: reference to undefined property b.cache[e[b.expando]] @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:59.882] Ignoring get or set of property that has [LenientThis] because the "this" object is incorrect. @ chrome://firebug/content/chrome/reps.js:476 [17:29:41.917] The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page. and again the opera has no problem at all and the your code and my code are working on the opera great.
  11. here is the error log using firefox: [23:08:37.433] ------ http://127.0.0.1/***/********/****/index.xhtml [23:08:37.512] GET http://127.0.0.1/***/********/****/index.xhtml [HTTP/1.1 304 Not Modified 0ms] [23:08:37.653] GET http://127.0.0.1/***/********/****/style/style.css [HTTP/1.1 304 Not Modified 0ms] [23:08:37.654] GET http://127.0.0.1/***/********/****/javascript/index.js [HTTP/1.1 304 Not Modified 0ms] [23:08:37.572] SyntaxError: in strict mode code, functions may be declared only at top level or immediately within another function @ http://127.0.0.1/***/********/****/javascript/index.js:5 [23:08:37.655] GET http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js [HTTP/1.1 304 Not Modified 0ms] [23:08:37.593] SyntaxError: Using //@ to indicate source map URL pragmas is deprecated. Use //# instead @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:1 [23:08:37.593] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.594] TypeError: function o does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.594] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.594] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.594] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] TypeError: function R does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] TypeError: function at does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.597] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.597] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: function In does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: function zn does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: function Zn does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.599] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.606] ReferenceError: reference to undefined property d.attributes[c].expando @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.606] ReferenceError: reference to undefined property e.selector @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.638] SyntaxError: illegal character @ http://127.0.0.1/***/********/****/index.xhtml:33 [23:08:37.719] Unknown property 'box-sizing'. Declaration dropped. @ http://127.0.0.1/***/********/****/index.xhtml [23:08:37.720] ReferenceError: reference to undefined property x.event.triggered @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.720] ReferenceError: reference to undefined property x.cache[e[x.expando]] @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 can anyone now help me find the problem? chrome log: Uncaught SyntaxError: Unexpected token ILLEGAL index.xhtml:71 but i have only 57 lines in my xhtml file. I'm adding the last version of the code i have. index.js: /* */ /* */ try { function jquery1() { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: 'red' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); } } catch(err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } xhtml file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <link rel="stylesheet" href="./style/style.css" /> <script src="./javascript/index.js"></script> <script src="./javascript/jquery-1.10.2.min.js"></script> <!--<script src="./javascript/jquery.slides.min.js"></script>--> <!--<script src="./javascript/jquery.easing.1.2.js"></script>--> <!--<script type="text/javascript" src="./javascript/movingpicsandmovies.js"></script>--> <!--<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>--> <!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>--> <!--<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>--> <!--<script src="http://code.jquery.com/jquery-1.9.1.js"></script>--> <!--<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>--> <script type="text/javascript"> try { $(document).ready(function () { jquery1(); }); } catch(err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); }​ </script> </head> <body> <div id='all_divs'> <div id='master'> <div id='top'></div> <div id='title_top'> <div id='**********'> <div id='new'>***</div> <div id='models'>*********</div> </div> <div id='title_op' class='title_all'>Contect us</div> <div id='title_op' class='title_all'>Projects</div> <div id='title_op' class='title_all'>Info</div> <div id='title_op' class='title_all'>Home</div> </div> <div id='title_buttom'></div> <div id='slideshow'> </div> </div> </div> </body> </html> or just the xhtml with js in the same file: (still not working with firefox and chrome.) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <link rel="stylesheet" href="./style/style.css" /> <!--<script src="./javascript/index.js"></script>--> <script src="./javascript/jquery-1.10.2.min.js"></script> <!--<script src="./javascript/jquery.slides.min.js"></script>--> <!--<script src="./javascript/jquery.easing.1.2.js"></script>--> <!--<script type="text/javascript" src="./javascript/movingpicsandmovies.js"></script>--> <!--<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>--> <!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>--> <!--<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>--> <!--<script src="http://code.jquery.com/jquery-1.9.1.js"></script>--> <!--<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>--> <script type="text/javascript"> try { $(document).ready(function () { //jquery1(); var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: 'red' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); }); } catch(err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); }​ </script> </head> <body> <div id='all_divs'> <div id='master'> <div id='top'></div> <div id='title_top'> <div id='***********'> <div id='new'>***</div> <div id='models'>***********</div> </div> <div id='title_op' class='title_all'>Contect us</div> <div id='title_op' class='title_all'>Projects</div> <div id='title_op' class='title_all'>Info</div> <div id='title_op' class='title_all'>Home</div> </div> <div id='title_buttom'></div> <div id='slideshow'> </div> </div> </div> </body> </html>
  12. i don't know what to say man because the link you post with my code, allow me to see the code active and it is working with the firefox and chrome, but on my server (real site with dns c-panel) and my local host 127.0.0.1 with the same chrome and firefox it is not working. i have other codes and samples that using js and i have no problem with those codes and the browsers: firefox and chrome do allow javascript to run. what else can i checked if i can see that your link with my code is woking fine in the firefox and chrome?
  13. here is my way with two div's in the same line: html sample code: ( as sub div's to 'sub' it's works as well. ) <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <link rel="stylesheet" href="index.css" /> </head> <body> <!--<div id='sub'>--> <div id='sub1'>1</div> <div id='sub2'>2</div> <!--</div>--> </body> </html> css sample code: /* background-color sub1 and sub2 */ #sub1 { background-color: #3856FF; } #sub2 { background-color: #1A44FF; } /* width + height + display (two div's in the same line) */ #sub1, #sub2 { display:inline-block; height:400px; width:400px; } notice: if you will change: display:inline-block; into this line: /*display:inline-block;*/ you will see what display do. here i got a sample with three div's in the same line: (html) <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <link rel="stylesheet" href="index3.css" /> </head> <body> <!--<div id='sub'>--> <div id='sub1'>1</div> <div id='sub2'>2</div> <div id='sub3'>3</div> <!--</div>--> </body> </html> (css) /* background-color sub1 and sub2 */ #sub1 { background-color: #3856FF; } #sub2 { background-color: #1A44FF; } #sub3 { background-color: #FFEB6C; } /* width + height + display (two div's in the same line) */ #sub1, #sub2, #sub3 { display:inline-block; height:400px; width:400px; } w3cschool - display hope that will help you.
  14. hey guys, i got a problem with Jquery. i have this code: $(document).ready(function () { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: '#FF0C55' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); }); explain what the code is doing: when the mouse is over class ".title_all" the id "#title_buttom" is exchange the exist background-color and when the mouse is mouseout the original color is exchange to the background-color of the id "#title_buttom" back. It is part of a new interface i'm building as some could guess. as you all see it is should work, but on my pc's linux operating systems suse and gentoo with the browsers firefox and chrome this code didn't working, but on the browser opera his working great. i ask some friends to run it and on their pc's linux and windows operating systems the firefox and chrome accept my code without any problem and it work's. what is the problem? i deleted all the history and close the and opened the browsers, but the code is still not working on my firefox and chrome. the code you see here on my server is more effective and advanced, but the problem stay the same as in this old version of my code you can see in this post. here is the html code, css code and the js code. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="./style/style.css" /> <script src="./javascript/jquery-1.10.2.min.js"></script> <script type="text/javascript"> $(document).ready(function () { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: '#FF0C55' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); }); </head> <body> <div id='all_div'> <div id='master'> <div id='title_top'> <div id='title_home' class='title_all'>Home</div> <div id='title_info' class='title_all'>Info</div> <div id='title_project' class='title_all'>Projects</div> <div id='title_contectus' class='title_all'>Contect us</div> </div> <div id='title_buttom'></div> </div> </div> </body> </html> css code: #all_div { width:1250px; height:800px; background-color:#0C39FF; } #master { top:5px; width:80%; position:relative; left:10%; } #title_home, #title_info, #title_project, #title_contectus, #title_buttom { background-color:#26FF1E; } #title_home,#title_info,#title_project,#title_contectus { border-top-left-radius: 15px; border-top-right-radius: 15px; display:inline-block; font-size:40px; text-align:center; } #title_home:hover, #title_info:hover, #title_project:hover ,#title_contectus:hover { background-color:#FF1145; } #title_home, #title_info, #title_project { width:235px; } #title_contectus { width:280px; } #title_buttom { height:20px; border-bottom-right-radius: 20px; border-bottom-left-radius: 20px; }
  15. hey, i found what was my problem in this model. the path i gave was from the javascript to the php, but the reference to the php need be to the html file and not to the js file. once i set the path in the external js file so the path will be from the html to the php and not the js file the problem solve.
  16. i have a problem with the path. i even tried put the js and the php in the folder,but the js don't find the php. the js is working but it is isn't find the php page and i don't know why. i check with <?php echo '<script language="JavaScript">alert("1");</script>'; ?> with the address in the browser: 'http://127.0.0.1/folder/private/php/index.php' and the php page is fine. 127.0.0.1 folder index.html - html file private - folder php index.php - ajax js file js index.js - ajax js file the path i have gave to the js file: './../php/index.php' (work in other models of ajax i have) 'http://127.0.0.1/folder/private/php/index.php' is working fine if i'm insert it to the browser. i even tried when i put the files (js and php) in the same folder as html, but it is n't working in this model. 127.0.0.1 folder index.html - html file index.php - ajax js file index.js - ajax js file the path i have gave to the js file: 'index.php' what is the problem?
  17. thanks, i didn't know this functions are exist and that why i turn to stripos. what about my question about the resources of every function? can you answer it?
  18. thanks for the answer but is what is taking less resources strlen or strripos/stripos in this case? it is still don't answer my question case number two: '/lalala/temp/index.html' - one-> 'index.html' two->index '/lalala/temp/news/index.html' - one-> 'news/index.html' two-> 'news/index' (case number two)
  19. hey guys, i'm try to print part of the string only and i'm trying with substr and strripos and stripos. <!DOCTYPE html> <html> <body> <?php $str= '/lalala/temp/index.html'; echo 'html = ' . strripos($str, "html"); echo '<br />'; echo 'html = ' . substr($str, stripos($str,"temp/") +5); echo '<br />'; echo 'html = ' . substr($str, stripos($str,"temp/") +5, strripos($str,"html") -1 ); ?> </body> </html> that output is: html = 19 html = index.html html = index.html what i'm trying to get is getting the file name of any file one once with the *.html and the second time without the ".html", but without the '/lalala/temp/'. i'm not trying to cancel sub folders path and i want to it in the output. let say i have the next two files: '/lalala/temp/index.html' - one-> 'index.html' two->index '/lalala/temp/news/index.html' - one-> 'news/index.html' two-> 'news/index' i also tried in the last line of the php this line: echo 'html = ' . substr($str, stripos($str,"temp/") +5, strripos($str,".") -1 ); as you all can see i'm looking here for the "." of the file but the output is the same: html = 19 html = index.html html = index.html what am i doing wrong exactly and why my first command can find the 'html' text and the two other can't?
  20. a, if I'm using: button_onload(); with my code the result is always: ( instead of using setTimeout(function(){ button_onload() }, 100); ) and that way i used: setTimeout(function(){ button_onload() }, 100); 13 or 12 is the lower number i tried with a success to get the response from the server, but below this number the result is the picture above. ------------------------------------------------------------------------------------------------- i tried now what you wrote in your notes DavidAM and that working with 100% success thanks. var xmlhttp = null; function loadXMLDoc(url,cfunc) { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=cfunc; xmlhttp.open("post",url,true); xmlhttp.send(); } onload = function() { myFunction('index.php'); } function myFunction(str) { document.getElementById('div_textarea').innerHTML = ""; loadXMLDoc(str, function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('div_textarea').innerHTML = xmlhttp.responseText; button_onload(); } }); //button_onload(); //setTimeout(function(){ button_onload() }, 100); } function button_onload() { document.getElementById('button').innerHTML = 'button 1'; document.getElementById('button2').value = 'button 2'; document.getElementById('button3').value = 'clear/clean'; } but what was the problem/mistake in my last code (link in number 3) or my old codes (links in number 1 and 2) i tried? 1 , 2 , 3 I'm asking to understood what i did wrong of course so i could understood my mistake and why the response time in this codes (1 , 2 , 3) is taking too much time. (the result is like the picture above in this message in those three cases)
  21. look at my sample how the next code use the same function of ajax more the once. xhtml file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="index.js"></script> <link rel="stylesheet" href="index.css" /> <title>textbox changing with ajax - php - version 6</title> </head> <body id='body'> <div id="div_textarea"><h2>Let AJAX change this text</h2></div> <button type="button" onclick='myFunction("index2.php");'>Change Content</button> </body> </html> js file: var xmlhttp = null; function loadXMLDoc(url,cfunc) { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=cfunc; xmlhttp.open("post",url,true); xmlhttp.send(); } onload = function() { myFunction('index.php'); } function myFunction(str) { document.getElementById('div_textarea').innerHTML = ""; loadXMLDoc(str, function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('div_textarea').innerHTML = xmlhttp.responseText; } }); //button_onload(); setTimeout(function(){ button_onload() }, 100); } function button_onload() { document.getElementById('button').innerHTML = 'button 1'; document.getElementById('button2').value = 'button 2'; document.getElementById('button3').value = 'clear/clean'; } index.php file: <?php $str1 = '<br />'; $str2 = '<textarea id="div_textarea_text"></textarea>'; $str3 = '<div id="button" onclick=""></div>'; $str4 = '<input type="button" onclick="" id="button2" value="" />'; $str5 = '<textarea id="div_textarea_text2"></textarea>'; $str6 = '<input type="button" onclick="" id="button3" />'; $str7 = '<textarea id="div_textarea_text3"></textarea>'; echo $str1 . $str2 . $str1 . $str3 . $str1 . $str4 . $str1 . $str5 . $str1 . $str6 . $str1 . $str7 . $str1; ?> index2.php file: <?php $str1 = '<br />'; $str2 = '<textarea id="div_textarea_text"></textarea>'; $str3 = '<div id="button" onclick=""></div>'; $str4 = '<input type="button" onclick="" id="button2" value="" />'; $str5 = '<textarea id="div_textarea_text2"></textarea>'; $str6 = '<input type="button" onclick="" id="button3" />'; $str7 = '<textarea id="div_textarea_text3"></textarea>'; echo $str2 . $str1 . $str3 . $str1 . $str4 . $str1 . $str5 . $str1 . $str6 . $str1 . $str7 . $str1 . $str2 . $str1; ?> the base code sample is from w3schools, but the response time with my php file or files is tooking too much time so i used in my code in setTimeout(function(){ button_onload() }, 100); instead of button_onload();. i even copy their code and tried that with my php file, but the result was with the same problem as my old code. your code present the echo from the php fine, but when i tried to change yours so i could used the ajax more then once, but it didn't work. like the sample i wrote for you now. you can click on the button more then once and the load function is using it as well.
  22. i didn't know that sorry about my mistake about w3c and w3schools, because i was sure the are the same body. i did saw a few problems in w3schools for a sample tag hr with xhtml. back to my problem now, davidam which site is better as guide because in the real system I'm building the ajax is been used more then once and that why i need a code like the new code i wrote without using setTimeout(function(){ loadform() }, 100); and only: loadform();
  23. your code is working jazzman1 but his not global and that why i created a new code with this guide (w3c) and the sample code (w3c as well) but even when i use callback function as the guide say's the result is this: (same as my old the old code why?) code of the js: var xmlhttp = null; function ajaxphp(str, c_func) { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = c_func; xmlhttp.open('post', str, true); xmlhttp.send(null); } function myFunction(str) //Using a Callback Function { ajaxphp(str ,function() { if (xmlhttp.readyState == 4 && xmlhttp.status==200) { document.getElementById('div_textarea').innerHTML = this.responseText; //possible to use xmlhttp.responseText as well } }); } onload = function() { myFunction('index.php'); //setTimeout(function(){ loadform() }, 100); loadform(); } function loadform() { button_onload(); disabled_div_textarea_text2(); } the rest of the code of the js is not relevent so is html the php that you saw them already, but if i'm changing the function onload and using setTimeout and not loadform: onload = function() { myFunction('index.php'); setTimeout(function(){ loadform() }, 100); //loadform(); } the output is: (working great) why this happening even when the guide show this way and why the response time from the server is still too long? if i am using js to create this html code from the client side only: <br /> <textarea id='div_textarea_text'></textarea><br /> <div id='button' onclick='button();'></div><br /> <input type='button' onclick='button2();' id='button2' /><br /> <textarea id='div_textarea_text2'></textarea><br /> <input type='button' onclick='clear_textarea1_2();' id='button3' /><br /> <textarea id='div_textarea_text3'></textarea> or other html code it is working great every time, but it is a security risk. that why i need the ajax to do that from the server side to the client side. in the real system i have to use ajax again and again so the ajax function have to be global to all the php pages because the same div present a different data when the user click on the buttons. this is a small module and a sample only.
  24. i never though about that and w3c forgot to write that in the ajax-php guide they publish. i even tried that with my code and that true jazzman1 and i used setTimeout to test that. function ajaxphp(){ if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else{// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState == 4 && xmlhttp.status==200){ document.getElementById('div_textarea').innerHTML = xmlhttp.responseText; } } xmlhttp.open('post', 'index.php', true); xmlhttp.send(); } onload = function(){ ajaxphp(); setTimeout(function(){ f_text() }, 100); } function f_text(){ disabled_div_textarea_text2(); button_onload(); clear_textarea1_2(); } about the code you wrote for me it did not worked in the xhtml file page and noting pass from the server to the client side as you can see in the picture. picture: (only the backround-color of div_textarea seen in output- css define only and not ajax) xhtml code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="index.js"></script> <script type="text/javascript" src="jquery.js"></script> <link rel="stylesheet" href="index.css" /> <script src="jquery-2.0.3.min.js"></script> <title>textbox changing with ajax - php - version 1</title> <script language="JavaScript"> $(document).ready(function(){ str1(); }); </script> </head> <body id='body'> <div id='div_textarea'></div> </body> </html> but on the html file it working great and that should work on the xhtml file. picture: html code: <html> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="index.js"></script> <script type="text/javascript" src="jquery.js"></script> <link rel="stylesheet" href="index.css" /> <script src="jquery-2.0.3.min.js"></script> <title>textbox changing with ajax - php - version 1</title> <script language="JavaScript"> $(document).ready(function(){ str1(); }); </script> </head> <body id='body'> <div id='div_textarea'></div> </body> </html>
  25. can you tell me why please? this is the way i used: onload = function() { ajax_php(); //requested data from the server button_onload(); // set the values clear_textarea1_2(); disabled_div_textarea_text2(); //disable the textarea } i did call ajax_php() first and then i call button_onload() so why the server don't pass the data from the server to the client side exactly as he should do? because i can see the output of the server to the client side on the screen and you can see that in the picture.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.