Mikijs Posted September 15, 2008 Report Share Posted September 15, 2008 gribetu zinat ka var veidot tipa <script src="js/page.js?v=1.0"></script> <script src="js/page.js?v=1.1"></script> un ka tas atteljos koda? piemeram if(V == 1) { function funkcija() { return X; } }else if(V == 1.1){ function funkcija() { return Y; } } Link to comment Share on other sites More sharing options...
indoom Posted September 15, 2008 Report Share Posted September 15, 2008 <script type="text/javascript">V = '1.0';</script> <script type="text/javascript" src="js/page.js"></script> <script type="text/javascript">V = '1.1';</script> <script type="text/javascript" src="js/page.js"></script> Link to comment Share on other sites More sharing options...
Mikijs Posted September 15, 2008 Author Report Share Posted September 15, 2008 nu ka .. ne :/ piemeram ja man ri viens Js fails kura ir // Version 1.0 function page_render() { .... } // Version 1.1 function page_render() { .... } // Version 1.2 function page_render() { .... } Teiksim ja ielieku script src="script.js?version=1.0"> tad njems tikai 1.0 dalu vai 1.1 vai 1.2 .. Link to comment Share on other sites More sharing options...
andrisp Posted September 15, 2008 Report Share Posted September 15, 2008 Nu bet, lai arī nav diezko smuki, indoom variants tak tieši to tev ļaus darīt. Vēl viens variants ir no skripta skanēt DOM koku (tb pašu HTML) un izekstraktēt to infu. Bet ja lapā gribēsi iekļaut vairākas reizes vienu un to pašu skriptu (bet ar atšķirīgiem V), tad arī tas būs ļoti problemātiski. Link to comment Share on other sites More sharing options...
Mikijs Posted September 15, 2008 Author Report Share Posted September 15, 2008 nja.. :/ vnk gribeju izmeiginat ko jaunu Link to comment Share on other sites More sharing options...
nemec Posted September 17, 2008 Report Share Posted September 17, 2008 uzliec lai .js failus apstrādā ar php. un tad if(<?php echo $_GET['v'];?> == 1) { function funkcija() { return X; } }else if(<?php echo $_GET['v'];?> == 1.1){ function funkcija() { return Y; } } par sevi varu pateikt, ka es katrā nopietnā lapā laižu daļu javascripta caur php. Tikai tādā veidā var pilnīgi atdalīt html no javascripta Link to comment Share on other sites More sharing options...
bubu Posted September 17, 2008 Report Share Posted September 17, 2008 Īsti nesapratu - kāds JS atdalīšanai no HTML ir sakars ar JS koda laišanu caur php? Link to comment Share on other sites More sharing options...
nemec Posted September 17, 2008 Report Share Posted September 17, 2008 nav nekāds sakars. ja vajag no php padod mainīgos javascriptam, tad kā to izdarīt? ar ajaxu? Link to comment Share on other sites More sharing options...
Recommended Posts