Forum Moderators: not2easy

Message Too Old, No Replies

Can this html be wrapped up in a style sheet?

         

stcrim

2:00 am on Sep 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can the html below be wrapped up in a style sheet so it can be called remotely rather than having to reside on the actual page? There will be two other scripts called along with the style sheet.

Sorry, rank beginner here...

-s-

<div id="point1" STYLE="position:absolute;visibility:visible;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="javascript: MM_openBrWindow('http://www.mysite.com','','top=5,left=5,width=535,height=560,resizable=yes,scrollbars=yes')">
<img src="http://www.mysite.com/myImage.gif" width=96 height=60 alt="" border="0">
</a>
</td>
</tr>
<tr>
<td>
<p align="center">
<a href="javascript: MM_openBrWindow('http://www.mysite.com/more.html','','top=5,left=5,width=535,height=560,resizable=yes,scrollbars=yes')">
<font face="Arial" size="2" color="#0000FF">More Info</font></a></p>
</td>
</tr>
<tr>
<td>
<center>
<a href="javascript: MM_openBrWindow('http://www.mysite.com/new.html','','top=5,left=5,width=535,height=560,resizable=yes,scrollbars=yes')">
<font face="Arial" size="2" color="#0000FF">What's New</font>
</a></center>
</td>
</tr>
</table>
</div>

[edited by: SuzyUK at 10:24 am (utc) on Sep. 27, 2004]
[edit reason] reduced scrollism [/edit]

Krapulator

7:21 am on Sep 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could do something along these lines:

<script type="text/javascript">
<!--
function winPop(sLocation,sWidth,sHeight,sScrollbars)
{window.open(sLocation, '', 'toolbar=0,resizable=0,scrollbars=' + sScrollbars + ',left=2,top=2,width=' + sWidth + ',height=' + sHeight);}
-->
</script>
<style type="text/css">
<!--
#point1{
position:absolute;
visibility:visible;
font-family: arial, verdana, sans serif;
color: #0000FF;
font-size: 11px;
width: 96px;
}
#point1 a{
display: block;
width: 100%;
text-align: center;
}
-->
</style>
<div id="point1">
<a href="http://www.mysite.com" onclick="winPop(this,535,560,1); return false;">
<img src="http://www.mysite.com/myImage.gif" width=96 height=60 alt="" border="0">
</a>
<a href="http://www.mysite.com/more.html" onclick="winPop(this,535,560,1); return false;">
More Info</a>
<a href="http://www.mysite.com/new.html" onclick="winPop(this,535,560,1); return false;">
What's New </a>
</div>

Ive used a less cluttered js to pop up a new window and I've put the js call into an onclick attrib instead of the href - thus non js users can still use the link.

You can move the css and the js into external files and be left with only:

<div id="point1">
<a href="http://www.mysite.com" onclick="winPop(this,535,560,1); return false;">
<img src="http://www.mysite.com/myImage.gif" width=96 height=60 alt="" border="0">
</a>
<a href="http://www.mysite.com/more.html" onclick="winPop(this,535,560,1); return false;">
More Info</a>
<a href="http://www.mysite.com/new.html" onclick="winPop(this,535,560,1); return false;">
What's New </a>
</div>

mincklerstraat

7:44 am on Sep 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could also just have those js and css files that are linked in the <HEAD> linked up with absolute url's (including the http:// and all that).

Another thing that might work for you is just to set the <base href="ht*p://mysite.com"> in the head before you go calling your css and js. Could be a nice one-line solution. That way, even when it's called remotely, all your relative stuff gets picked up properly.

createErrorMsg

12:08 pm on Sep 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can the html below be wrapped up in a style sheet so it can be called remotely

The answer to this question is no. html cannot be placed in a stylesheet; only styles can be placed in a stylesheet. What you are looking to do is, as said above, the realm of javascript or server-side scripting.

jetboy_70

2:47 pm on Sep 27, 2004 (gmt 0)

10+ Year Member



If you're just after the ability to include a section of code remotely, you might want to take a look at SSI (server-side includes) or bringing in a separate file using iframes.

If you've got access to any server-side scripting language, it'll support the including of files to. For example, in PHP: <?php include 'mycode.php';?>.