Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Javascript File with Code

$
0
0

I have several .aspx pages that use the same javascript functions.These functions include code <%= variable%>. I want to pass these functions to a .js file but they are not displayed correctly with Visual Studio and also the functions are not executed.

// --------------
// .Aspx
// --------------<head runat="server">    <script type="text/javascript" src="../js/Js_Common.js"></script></head><script language="javascript" type="text/javascript"> 
  var myvariable = fcn_variable();</script>

// --------------
// Js_Common.js
// --------------
function fcn_variable()
{   var myvariable = null;
    myvariable = '<%=Form_Label.ClientID%>';
    return myvariable;
}


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>