Buoka Posted January 18, 2008 Share Posted January 18, 2008 I want/need to tidy up my xhtml.What I have at the moment are 90+ lines of script all similar to: <script type="text/javascript">function SpAc46(){window.open("Accs/SpAcCovershelf.html","windowname","height=260,width=675")}</script> in the head. Each of these (46 so far) is called by the click on an image thus: <input class="accs" type="image" src="Images/SpAc_Covershelf.jpg" alt="Covershelf" title="Covershelf" value="SpAc46" onclick="SpAc46()" /> What I really want is to move the 90+ lines of javascript out into one function that is very few lines. By this I mean that the image click calls the function (called, say, AccessoryCall) and passes a parameter (e.g. SpAc46). The function then opens SpAc46.html.Simple quick and clean.Can it be done? :) Link to comment Share on other sites More sharing options...
Ingolme Posted January 18, 2008 Share Posted January 18, 2008 Just do it this way:onclick="openSomething('SpAc46')"java script:function openSomething(addr) {window.open(addr,'name','width=500,height=500');} Link to comment Share on other sites More sharing options...
Buoka Posted January 21, 2008 Author Share Posted January 21, 2008 Just do it this way:onclick="openSomething('SpAc46')"java script:function openSomething(addr) {window.open(addr,'name','width=500,height=500');} Thank you so much Ingolme!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.