|
#1
|
|||
|
|||
|
I know it is possible, but I don't know how to shorten HTML with JS. Anyone have any ideas for my following code...
Code:
<!--MC Radio V2-->
<script type="text/javascript" src="http://www.geocities.com/yort1223/MCRV2/HideShow.js">
</script>
<a title="Show Tables" href="javascript:toggleDisplay('table1')"><b><center>[Show/Hide MC Radio]</center></b>
<div style="display:none;" id=table1>
<div class="tableborder"> <div class='maintitle' align='left'>MC Radio V2</a></div> <table border="0" cellspacing="1" cellpadding="4"> <tr> <th align="center" width="23%" class='titlemedium'>Station</th> <th align="center" width="32%" class='titlemedium'>Description</th> <th align="center" width="20%" class='titlemedium'><center>Genre</center></th> </tr> <tr> <td class="row4" align="center">
<b>Listen to </b><form name="form1">
<select name="station" size="1" onChange="displaydesc(document.form1.station, description, genre, 'textcontainer1')">
<option selected value="http://www.1club.fm/clubfm_media/v42.aspx?station=activex" target="newwin">Active Radio X</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=modernrock" target="newwin">Modern Rock</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=classicrock" target="newwin">102 Rock</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=hairband">Hair Band Rock</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=classicalt-dude" target="newwin">Alternative Rock</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=clubuk" target="newwin">House of Trance</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=techno" target="newwin">Techno Club</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=harddance" target="newwin"> Gruvsonic Hard Dance</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=trance" target="newwin">Trance</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=rnb" target="newwin">R&B Hits</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=power" target="newwin">Old School Rap</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=breakbeat" target="newwin">70's Pop Hits</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=goapsy" target="newwin">80's Pop Hits</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=ibiza" target="newwin">90's Pop Hits</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=hitmusic" target="newwin">Channel 1</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=vradio" target="newwin">Variety Hits</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=vybe" target="newwin">70's Decade Hits</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=clubuk" target="newwin">80's Decade Hits</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=harddance" target="newwin">90's Decade Hits</option>
<option value="http://www.1club.fm/clubfm_media/v42.aspx?station=hkcountry" target="newwin">Kicker Country</option>
</select>
<input type="button" value="Listen"
onClick="jumptolink(document.form1.station)">
</form>
</a></td> <td class="row4">
<span id="textcontainer1" align="left" style="font:italic 13px Arial">
</span>
<script type="text/javascript" src="http://www.geocities.com/yort1223/MCRV2/description.js"></script>
<br /></td> <td class="row2" align="center">
<span id="textcontainer2" align="center" style="font:bold 13px Arial">
</span>
<script type="text/javascript" src="http://www.geocities.com/yort1223/MCRV2/genre.js"></script>
<script type="text/javascript" src="http://www.geocities.com/yort1223/MCRV2/main.js"></script>
</td></table>
<table border="0" cellspacing="1" cellpadding="4"> <tr> <th align="left" width="10%" height="5%" class='darkrow2'><a href="http://z11.invisionfree.com/MooseCreations" target="_blank">©</a> - Created By Agent Moose</th></tr></table>
</div><br></div>
</div><br></div>
<!--End MC Radio V2-->
|
|
#2
|
||||
|
||||
|
What do you mean by "shorten HTML"?
|
|
#3
|
|||
|
|||
|
Make it so that it is like this...
Code:
<script src="WWW.URLHERE.COM"></script> Quote:
The code above will be in URL part. Just like shortening JS. But with HTML... |
|
#4
|
||||
|
||||
|
Probably a better way to do this, but In the new js file type in this:
Code:
document.write('<html><title>This is a test</title></head><body></body></html>');
Code:
<script type="text/javascript" src="newfile.js"></script> |
|
#5
|
||||
|
||||
|
Will work roughly, but is not a good idea, since it introduces a dependency on Javascript, slows down the page loading time, and eliminates progressive rendering. Don't do it.
If you need to generate something like that, do it serverside. By no means use client-side scripting.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP! |
|
#6
|
|||
|
|||
|
What do you mean by Sever Side?
|
|
#7
|
||||
|
||||
|
Server side would be by using PHP, ASP or some other type of programming language on your server.
|
|
#8
|
|||
|
|||
|
oh. Well I don't know PHP or ASP. So...I can't do it...
|
|
#9
|
||||
|
||||
|
Also.. if you have the js file on your server it's still there somehow, no matter which way you put it. Just because it's in an external file doesn't mean the overall filesize will be smaller.
Some people can disable JavaScript if they want to with their browsers, and that's what makes it unreliable. |
|
#10
|
||||
|
||||
|
Well, you could DOM it and put it in an external file.
//Also what mburt said ^^
__________________
Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM. Currently: enjoying the early holidays :)Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|