Load different image based on screen width

Lets assume that I'm calling an image like

<img src="http://server:8080/graphs/ChartGen?PID=982&minutes=480&height=30&width=1400" />

Where the width is "1400" at the end, how can I make that "1400", 60% of the users screen width instead?

Answers


You should set the parameter in JavaScript. Check the source of Google Books.

<script language="javascript" type="text/javascript">     

var url= "http://server:8080/graphs/ChartGen?PID=982&minutes=480&height=30&width=" + (screen.width * 0.60);     


</script> 

Need Your Help

dynamically resizing an array of strings

c

`I need an array of strings in which the length of the array is not known at compile time. what I've done is:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.