alin19 Posted February 12, 2008 Share Posted February 12, 2008 can i use javascript to take data from file? and can i do something like this? <!-- var x='sadsadsa' -> <body> x </body> can i do this? Quote Link to comment https://forums.phpfreaks.com/topic/90745-can-i-use-javascript-to-take-data-from-file/ Share on other sites More sharing options...
Psycho Posted February 12, 2008 Share Posted February 12, 2008 JavaScript cannot access the user's file system. Quote Link to comment https://forums.phpfreaks.com/topic/90745-can-i-use-javascript-to-take-data-from-file/#findComment-465243 Share on other sites More sharing options...
phpQuestioner Posted February 13, 2008 Share Posted February 13, 2008 can i use javascript to take data from file? What exactly do you want to do or get? You can do this: <script language="javascript"> var x="sadsadsa"; </script> </head> <body> <script language="javascript"> document.write(""+x+""); </script> </body> Quote Link to comment https://forums.phpfreaks.com/topic/90745-can-i-use-javascript-to-take-data-from-file/#findComment-465436 Share on other sites More sharing options...
alin19 Posted February 13, 2008 Author Share Posted February 13, 2008 this: <script language="javascript"> var x="0.0,3.7037037037037,7.4074074074074,11.111111111111,14.814814814815,18.518518518519,22.222222222222,25.925925925926,29.62962962963,33.333333333333,37.037037037037,40.740740740741,44.444444444444,48.148148148148,51.851851851852,55.555555555556,59.259259259259,62.962962962963,66.666666666667,70.37037037037,74.074074074074,77.777777777778,81.481481481481,85.185185185185,88.888888888889,92.592592592593,96.296296296296,100| 34.156378600823,34.567901234568,60.905349794239,66.803840877915,93.415637860082,90.39780521262,58.847736625514,84.224965706447,81.755829903978,94.513031550069,93.004115226337,61.316872427984,99.451303155007,87.242798353909,84.362139917695,71.467764060357,54.320987654321,76.954732510288,74.759945130316,100,58.847736625514,55.555555555556,77.914951989026,70.781893004115,76.131687242798,73.799725651578,59.122085048011,75.99451303155"; </script> </head> <body> </body> <body> <script language='javascript' type='text/javascript'> document.write(' <img src="http://chart.apis.google.com/chart? chs=1000x300 &chd=t: + x &cht=lc &chco=ffffff,000000 &chxt=x,y &chg=20,10,2,10 &chxl=0:|3|4|7|8|9|10|11|14|15|16|17|18|21|22|23|24|25|28|29|30|31|1|4|5|6|7|8|11|1:|0|73|146|219|292|365|437|510|583|656|729"alt="Sample chart" />'); </script> </script> </body> or this: <script language="javascript"> var x="0.0,3.7037037037037,7.4074074074074,11.111111111111,14.814814814815,18.518518518519,22.222222222222,25.925925925926,29.62962962963,33.333333333333,37.037037037037,40.740740740741,44.444444444444,48.148148148148,51.851851851852,55.555555555556,59.259259259259,62.962962962963,66.666666666667,70.37037037037,74.074074074074,77.777777777778,81.481481481481,85.185185185185,88.888888888889,92.592592592593,96.296296296296,100| 34.156378600823,34.567901234568,60.905349794239,66.803840877915,93.415637860082,90.39780521262,58.847736625514,84.224965706447,81.755829903978,94.513031550069,93.004115226337,61.316872427984,99.451303155007,87.242798353909,84.362139917695,71.467764060357,54.320987654321,76.954732510288,74.759945130316,100,58.847736625514,55.555555555556,77.914951989026,70.781893004115,76.131687242798,73.799725651578,59.122085048011,75.99451303155"; </script> </head> <body> </body> <body> <img src="http://chart.apis.google.com/chart? chs=1000x300 &chd=t: <script language='javascript' type='text/javascript'> document.write(+x+); </script> &cht=lc &chco=ffffff,000000 &chxt=x,y &chg=20,10,2,10 &chxl=0:|3|4|7|8|9|10|11|14|15|16|17|18|21|22|23|24|25|28|29|30|31|1|4|5|6|7|8|11|1:|0|73|146|219|292|365|437|510|583|656|729"alt="Sample chart" /> </script> </body> but none works Quote Link to comment https://forums.phpfreaks.com/topic/90745-can-i-use-javascript-to-take-data-from-file/#findComment-465660 Share on other sites More sharing options...
alin19 Posted February 13, 2008 Author Share Posted February 13, 2008 i've solve it with this: but x,y,z,t modify and my grafic doesn't is something wrong with my script? <html> <script language="javascript" type="text/javascript"> <!-- var x=50 var y=4 var z=50 var t=4 function test() { <?php //..... ?> document.write("<img src='http://chart.apis.google.com/chart?") document.write("&chs=1000x300") document.write("&chd=t:"+ x + "," + y + "|" + z +","+ t) document.write("&cht=lc&chco=ffffff,000000") document.write("&chxt=x,y") document.write("&chg=20,10,2,10") document.write("&chxl=0:|10:00|10:15|10:30|10:45|11:00|11:15|11:30|11:45|12:00|12:15|12:30|12:45|13:00|13:15|13:30|13:45|14:00|14:15|1:|0|73'" + "alt='Sample chart' />") x=x+10 y=y+10 z=z+10 t=t+10 update = setTimeout("test()", 100); } --> </script> <body onload="test()" > </body> </html> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/90745-can-i-use-javascript-to-take-data-from-file/#findComment-465831 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.