Troy III 272 Posting Pro

This is interesting ....[?!?] still haven't found anything working for you on internet?!

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Windows Media Player</title>
	<style type="text/css">
	#Player,
	input{width:400px;}
	p input{width:97px}
	</style>
</head>
<body>
<INPUT TYPE="File"   VALUE="Megamix.mp3"	onChange="Player.URL = this.value">
<p>
<INPUT TYPE="BUTTON" VALUE="Play"		OnClick="Player.controls.play()">
<INPUT TYPE="BUTTON" VALUE="Stop"		OnClick="Player.controls.stop()">
<INPUT TYPE="BUTTON" VALUE="Pause"		OnClick="Player.controls.pause()">
<INPUT TYPE="BUTTON" VALUE="Full Screen"	OnClick="if (Player.playState == 3) 
Player.fullScreen = 'true'">
</p>
<p></p>

    <SCRIPT type="text/javascript">
      if(-1 != navigator.userAgent.indexOf("MSIE"))
      {
        document.write('<OBJECT id="Player"');
        document.write(' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"');
        document.write(' width=300 height=200></OBJECT>');
      }
      else if(-1 != navigator.userAgent.indexOf("Firefox"))
      {
        document.write('<OBJECT id="Player"'); 
        document.write(' type="application/x-ms-wmp"'); 
        document.write(' width=300 height=200></OBJECT>');
      }    
    </SCRIPT>
</body>
</html>
Troy III 272 Posting Pro

I am trying to put up a rope border (border.png) on the sides of my center box of text. Text will work with z-index properly, but the border just will not show. Any ideas?

style.css =

* {margin:0px;padding:0px;top:0px;left:0px;}
body{
	text-align: center;
	background: #000000;
}
#central{
	margin-right: auto;
	margin-left: auto;
	margin-top: 10px;
	position: relative;
	width: 777px;
	text-align: left;
	background-color: #FFFFFF;
}
#contentborderside{
	margin-top: 252px;
	position: absolute;
	width: 800px;
	height:900px;
	background: #FFFFFF url("border.png");
	z-index:1;
}
#content{
	margin-top: 252px;
	position: absolute;
	width: 500px;
	background:#c9a87f;
	z-index:-1;
}

HTML =

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Horseback Adventures</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div id="central">
	
	<div id="contentborderside">
		<p>There should be a rope on either side of this!</p>
	</div>
		
	<div id="content">
		<h1>Why won't the image show?</h1>
		<p>Try as I might I can't get the z-index to work for my border ='( </p>
		<p>Any ideas?</p>
	</div>

	</div>
</body>

The image is attached.

Thank you!
-optikali

Some little dumb mistake I'm sure...
p.s.: check the little thingy in red inside your code, That's what's missing here.

Troy III 272 Posting Pro

Is it possible to iterate through an anonymous array of strings with a for loop?

Here's what I'm trying to do:

for ( i in ['country', 'city', 'state'] ) {
    doSomethingWithString(i);
}

What I want is the string, but what I'm getting is the index number of the array, which I can't use because the array isn't named.

Thank you.

--
-- Ghodmode

in fact, there is no such thing as anonymous array, this supposedly "arrray" will be garbage collected as soon as the function has passed over.

Therefore you must initiate/create that array before using it at least locally.

for ( i in o = ['country', 'city', 'state'] ){ 
	doSomethingWithString(o[i]);
}

A more readable written form of the same with array value alert:

for ( value in option = ['country', 'city', 'state'] ){ 
	alert( option[ value ] )
}

will serially alert:
country
city
state --- I believe this was what you were looking for.
Cheers.

Troy III 272 Posting Pro

Is there anyway to get images to be the "correct" size - i.e. fit the width of the text?

This is what currently happens:
http://engineeringnotes.net/personal/pictures.shtml

Thanks,

Dave

So you want them to be looking something like this (see attachment image)?
Add this line in your
CSS

#main img {width:100%}
Troy III 272 Posting Pro

hi my navigaion keeps on moving onto a new line and i cant seem to stop it. i have tried all that i can think of.

thanks

body{
height:100%;
width: 150%;
margin:0;
}
  
  #nav{
  clear:both;
  font-weight:bold;
  color:black;
  margin-left:4px;
  float:left;
  list-style-type:none;	
  background:url(navshadow.gif) no-repeat 8px 100% #fff;
  width:100;
  padding-bottom:21px;
  position:absolute;
  left:15%;

}
html>body #nav{
  margin-left:8px;
  background:url(navshadow.gif) no-repeat <strong>4px</strong> 100% #fff;
}
#nav li{
  list-style-type:none;
  float:left;
  margin:0 0 0 4px;
  padding:0 0 0 10px ;
  border-bottom:1px solid #999;
  background:url(tabgrey.png) #c0c0c0 top left no-repeat;
  
}
#nav li a{
  color:black;	
  background:url(tabgrey.png) transparent top right no-repeat;
  display:block;
  padding:0 10px 0 0;
  float:left;
  
}
#nav li.cur,
#nav li.over,
#nav li:hover
{
  background:url(tabblue.gif) #3c785c top left no-repeat;
  border-bottom:1px solid #2c6b2c;
}

#nav li strong,
ul#nav li.cur a,
ul#nav li.over a,
ul#nav li:hover a
{
  display:block;
  color:#fff;
  padding:0 10px 0 0;
  text-decoration:none;
  background:url(tabblue.png) transparent top right no-repeat;
}

  
  


  </style>
  <script type="text/javascript">
/*<![CDATA[*//*---->*/

function rollover()
{
  if(!document.getElementById || !document.createTextNode){return;}
  var n=document.getElementById('nav');
  if(!n){return;}
  var lis=n.getElementsByTagName('li');
  for (var i=0;i<lis.length;i++)
  {
    lis[i].onmouseover=function()
    {
      this.className=this.className?'cur':'over';
    }
    lis[i].onmouseout=function()
    {
       this.className=this.className=='cur'?'cur':'';
    }
  }
}
window.onload=rollover;

/*--*//*]]>*/
</script>
  
  
 </head>
 <body>
 
 <img src="logo.jpg" width="40%" />

 
 
<ul id="nav">
	<li class="cur"><strong>About jjjjjjjjjjjjjjjjjUs</strong></li>
  <li><a href="index.html">Garden Centre</a></li>
  <li><a href="step2.html">Dahlias Kitchen</a></li>
  <li><a href="step3.html">Kool Kamping</a></li>
  <li><a href="step4.html"></a>Pets Corner</li>
  <li><a href="step4.html"></a>Suttons Buildings</li>
</ul>

Delete everything marked RED

Troy III 272 Posting Pro

need to read and write to xls (excel sheet) using javascript
read and write should be to specific cell in that sheet
if its possible , please help do it
thanx .

you will need Exel activeX object for this.

This is a demo code from MSDN:

var ExcelApp = new ActiveXObject("Excel.Application");
var ExcelSheet = new ActiveXObject("Excel.Sheet");
// Make Excel visible through the Application object.
ExcelSheet.Application.Visible = true;
// Place some text in the first cell of the sheet.
ExcelSheet.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";
// Save the sheet.
ExcelSheet.SaveAs("C:\\TEST.XLS");
// Close Excel with the Quit method on the Application object.
ExcelSheet.Application.Quit();
Troy III 272 Posting Pro

This is a sample of a list I would use. The option value is the value that will be stored with the post. I can't hard code the list because each client can have more, less, and other defined terms. The users maintain the lists in a fully relational database.

<select name="disposition">
<option value="A001" SELECTED>Scene</option>
<option value="A002">Interfacility</option>
<option value="A003">PR - Scene</option>
<option value="A004">PR - Interfacility</option>
<option value="A005">Search</option>
<option value="A006">Transport Team</option>
<option value="A007">Maintenance</option>
<option value="A008">Administrative</option>
<option value="A009">Pilot Recurrency</option>
<option value="A010">Crew Training</option>
</select>

I am 99% sure I want a drop-down list - unless there is a better way to allow the end user to select from a list. I thought a drop-down would be the best because I can export/create a list of data from the databases, I just don't know how to take the raw text list and drop it into the HTML code.

The regular application is used for flight dispatch and patient charting for Air Medical helicopters. Our clients want a web front end to do some tasks like scheduling flight requests. With over 130 clients, they each have different ideas of what should be in any given list. The example above is from a list of possible request types.

THanks again in advance for your help.

good.
this would be your HTML

<form name="dropDown" action="" method="" >
<select name="disposition">
<option value="" >Select Scene</option>
</select>
</form>

this would be the string format retrieved from your dB:

var	list = "A001, Scene, A002, Interfacility, A003, PR - …
Troy III 272 Posting Pro

The poster marks the thread solved though admins probably have the ability it's not really their job to do so.

Thanks I appreciate it.
Cheers.

Troy III 272 Posting Pro

i have html files at C:/Documents and Settings/USER/Application Data/Mozilla/Firefox/Profiles/ksx3y6oy.default/bookmarks.html. the html files is in my hard disk. then how im going to called the html files to be an input in my javascript coding.someone please help me

the quick answer is: "you can't!"
Javascript is not allowed to mess around with your file system. And you can't put documents in javascript vars.

Dukane commented: good answer +3
Troy III 272 Posting Pro

Thanks a lot for the insight and the great examples!
Will work on this ASAP.

I will have to mention this forum in the credits :)

Troy you are right, nothing to do with css classes or whatever, I meant two different elements or levels.

Nice
I'm puzzled though, why is that code using same id on multiple elements?

And I have another puzzle somebody could answer to me: whose responsibility is to mark threads as solved, :: the thread starter or admins? (!please, I really don't know the answer to this, just curious!)

Troy III 272 Posting Pro
<html>
	<head>
    <style type="text/css">
<!--
.fontStyle {
	font-family: Verdana, Geneva, sans-serif;
	font-size: small;
	font-weight: bold;
	color: #67A2DC;
}

-->
    </style>
		<script type="text/javascript">			

			window.onload=function(){
				loadVideo();
			}
			
	
			function loadVideo()
			{
				
					if (parseInt(navigator.appVersion)>3)
						{
							if (navigator.appName == "Netscape")
							{
								winW = window.innerWidth;
								winH = window.innerHeight;
							}
					if (navigator.appName.indexOf("Microsoft") != -1)
							{
								winW = document.body.offsetWidth;
								winH = document.body.offsetHeight;
							}
			}
				
				var dimW = winW-50;
				var dimH = winH-20;
				var w1 = dimW.toString();
				var h1 = dimH.toString();
				
				
				
				if(document.getElementById("vidEmbed") != null)
				{
					
					document.getElementById("vidEmbed").src = "Welcome_1.wmv";
					document.getElementById("vidEmbed").style.width = w1;
					document.getElementById("vidEmbed").style.height = h1;
				}
				else if(document.getElementById("Player") != null)
				{
					document.getElementById("Player").style.width = w1;
					document.getElementById("Player").style.height = h1;
					//document.getElementById("objectSrc").value = "Welcome_1.wmv";
				
document.getElementById("Player").url = "Welcome_1.wmv";}


			}
		</script>

	</head>
<body><div>
<p><span class="fontStyle">Introduction<br>

</span>
  <object id="Player" width="100%" height="100%" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" style="border:0px;"> 
    
    <param name="autoStart" value="True">
    <param name="uiMode" value="full">
    <param name="volume" value="50">
    <param name="mute" value="false">
    <param name="URL" id="objectSrc" value="">
    <embed src="" id="vidEmbed" width="100%" height="100%" autostart="true" uimode="full" volume="50" mute="false"> </embed>
  </object>
</p>
</div>
</body>
</html>

Remove red lines!
Set the <param name="uiMode" value="none"> If you don't want player controls to appear on your media.

Troy III 272 Posting Pro

Hello all.

I have a mootools accordion in the website I'm building that uses two classes: "toggler" for the titles and "element" for the content.

I'm in the need of adding an input field at the bottom of the "element" DIV that the user has opened.

Problem is, every content of every different toggle has the same id="element".

The only difference is that the one opened has the visibility set to "visible".

Is there a way so I can write in that visible DIV from Javascript?

I've underlined some conflicting statements in your problem description, and the clearance on that part might give some strait forward solution.

That is: if explanation stating that elements are using the word "element" as an ID, is just a writing mistake, meaning that the first statement is in fact correct, you could solve your problem by simply adding an unique ID to that element that would enable you to access its properties directly later on.

But if all these elements are really using ID instead of CLASS selector you'll be forced to take another route. And there are lots of them...

And since the visibility property is being set by javascript than javascript will be able to retrieve its value also.
So one of the ways to go, would be to write a function that does this:

function getVisibleEl(){
	var els = document.getElementsByTagName('div');
	for(var i=0; i<els.element.length; i++){
		if(els.element[i].style.visibility=="visible" ){
			//this is our DIV, write to
			els.element[i]
			//your planed input …
Troy III 272 Posting Pro

This code enables you to publish a CSS only with mouse click and keyboard tab image swap.

Attached is a Demo example of how it would look on IE6.

To ensure the greatest possible cross-browser compatibility/support this code uses CSS level 1 capabilities only.

One of extra benefits is that it will function even within browsers that doesn't support, and/or clients that have disabled javascript engine to.

Big images are asynchronous keeping the page as light and as fast as possible. The code itself will fall under 6KB if relative URLs are used. [here I'm using absolute paths to some real images available on the net for demonstration purposes only].

It's a copy-paste ready for preview demo.
It is HTML4.01 Strict and CSS2.1 validated.

peter_budo commented: Nice example +24
Dani commented: Making use of code snippet attachments I see +36
Troy III 272 Posting Pro

I have created a PHP page using CSS for styling. It looks great in IE. However, in Firefox, it is just a mess. Here is the link to the page:

http://www.laudontech.com/temp/pceditor.php

Any ideas? Should I develop for Firefox, then try and fix for IE? Or, the other way around?

Thanks in advance,

Mapper

Yeah, it looks as it should on IE.

All container elements are broken in Netscape based browsers.
This is known as a bleeding fox syndrome bug, or "fox on fire behaviour".
It will drop everything out of it container.
You'll be forced to manually set the height of each container element so it'll look as if its holdin it.

  • The div id=search will need the height of exactly 20px.
  • The div id=search2 will need the height of at least 22px.
  • The div id=top of the class=section will need the minimum height of 160px.
  • The div id=middleedit of class=section will need the height of 512px.
  • The div id=middle of class=section will need the same height of 512px. ! and try floating it too.

This should fix it.
Just remember that containers act as if they're inline elements in Netscape children too.

Troy III 272 Posting Pro

hmm is there an edit button?

anyway

i changed my code a bit to using event listeners but i still cant get the Id to appear in the alert i get either HTMLElement or something like that in the alert or i get an empty alert box
anyone know what im doing wrong?.

sorry for double post but i couldnt edit my first one.

function vulpagina()	{
	var maindiv=document.getElementById("maindiv");
		
for(i=0; i<26; i++){
	var imgnr = i;
var div=document.createElement("div");
var img=document.createElement("img");
var br=document.createElement("br");
var txt=document.createTextNode("dit is div " + i);

	img.src=album[imgnr].url;
	img.style.margin ="10px";
	img.style.padding ="10px";
	img.style.height="80%";
	img.onclick=getImgId;
		div.setAttribute("id","divje" + i);
		div.appendChild(img)
		div.setAttribute('style','float:left');
		div.style.width="20%";
		div.style.height="20%";
		div.appendChild(br);
		div.appendChild(txt);
			maindiv.appendChild(div);
		}
	}
		
function getImgId(){ id = this.id; alert( id ) }
Sereal_Killer commented: helpfull +1
Troy III 272 Posting Pro

Here,

First thing you should do is to remove your script from HTML element and place it somewhere before HEADER element closure.

Second:
Something on the right should follow something on its left, not the opposite, this adds confusion.
Put your HTML back to its normal order of its rendering flow, like this:

<DIV class=body>

 <DIV class=bodyTxt>
  <DIV class=bodyTxtInner>
	<H1>HOME</H1>
	<P>Gary Jones and Rick Taylor are the owner/operators (under the direct 
	supervision of their wives Janice and Carol) of the 
	<SPAN class=yellow><STRONG>
	Cypress Hill Winery</STRONG></SPAN>.
	 The current location 
	was opened in June, 2009.</P>
	<P>This small urban winery is in the lower level of an old sandstone and brick 
	building located in the downtown Carrousel District of Mansfield, OH. This is a 
	true wine cellar where the tasting room is situated in the midst of a working 
	winery. The exposed stone walls, the oak wine barrels and the rustic 
	surroundings all contribute to the ambiance and relaxing atmosphere. 
	</P>
  </DIV>
 </DIV>

 <DIV class=floatyImg>
  <IMG height=362 src="images/hompageImages.png" width=400>
 </DIV>

</DIV>

So you won't need the "z-index" anymore.

Third, - the CSS:

.body {
	background: url("images/BG.png"); 
	overflow: auto; 
	width: 100%; 
	height: 379px; }

.bodyTxt {
	padding: 5px 0 5px 10px;
	background: url("images/bodyBg.png"); 
	width: 400px; 
	color: #fff; 
	-moz-border-radius: 20px; 
	-webkit-border-radius: 20px;
	position: absolute;
	margin:10px; /* optional */}

.floatyImg {
	float: right;
	width: 400px; 
	position: relative;
	margin-right: 20px; }

.bodyTxtInner {
	padding: 0 0 0 15px; /* optional */
	width: 265px }

additionally

.separator {
	background: url("images/separator.png"); …
Troy III 272 Posting Pro

stay away from that site and block them.

few notes on interclick.com
http://google.com/safebrowsing/diagnostic?site=interclick.com/

i suggest you block these addresses:
www.interclick.com
a1.interclick.com
campaigns.interclick.com
ad.interclick.com

there should be more ....

stvrich commented: helped confirm my own feelings on this, tanx +1
Troy III 272 Posting Pro

that's because you are doing it the wrong way, -it is the div2 who should have its margins set to auto and there should be no float.
-Here, try this:

.DIV1 {
   width: 100%;
   height: 70px;
}

.DIV2 {
   margin: auto ;
   display: inline;
   text-align: center;
   width: 80px;
}
nigelburrell commented: Excellent solution +1
Troy III 272 Posting Pro

Well, now that you've learned that quotes can be used only in the logic of parenthesis (*) , but not (*] same as "*' etc, and that strings can be added with the + sign and automatically converted into stings when you ad some var value to it.

I also think that you've learned something that 99% of very old javascript coders don't know about Math.min and Math.max and similar, that is - you are not restricted to Math.min(x,y) or Math.max(x,y) only, as scripting reference examples describe it, since there is Math.min(x,y,z,...) .

Please, don't take what you read in books so literally.
Practice! And don't forget that JavaScript is very powerful language...

One thing I don't understand, is why is there no Average Math Object, in Math object collection. Something like Math.average(45,42,47,41,46) , that will return the average numeric value of the group, but that's not so interesting for discussion.

Therefore I've already made one, and introduced it in this example as a Troy III Script to JavaScript Math.object Extension, so that others who might need that functionality may use it also.

So here it is - your last working code rewritten:

<html>
<head>
<title>Implementing Math.average Extension</TITLE>

<script src="Troy III MathAverage.js" type="text/javascript"></script>

<script type="text/javascript">

var stNumber = parseFloat(prompt("Enter 1st number and Click OK", 0));
var ndNumber = parseFloat(prompt("Enter 2nd number and Click OK", 0));
var rdNumber = parseFloat(prompt("Enter 3rd number and Click OK", 0));

var total    = stNumber + ndNumber +  rdNumber; …
nav33n commented: Good work! +8
Troy III 272 Posting Pro

OK
try: alert("The Sum is:" + total + "; The average is: " + average); , to alert them both in one turn.

try:

var largest = Math.max(firstnumber, secondnumber, thirdnumber);
var smallest = Math.min(firstnumber, secondnumber, thirdnumber);

alert("smallest:" + smallest + "; largest: " + largest )

to remove the junk you use for this simple task: meaning following:

if(firstnumber > secondnumber && firstnumber > thirdnumber){
var largest= firstnumber;

}
else if(thirdnumber > firstnumber && thirdnumber > secondnumber){
var largest= thirdnumber;
}
if(firstnumber < secondnumber && firstnumber < thirdnumber){
var smallest= firstnumber;
}
else if(secondnumber < firstnumber && secondnumber < thirdnumber){
var smallest= secondnumber;

taht can't posibly be working!

Troy III 272 Posting Pro

try this site (http://layouts.ironmyers.com, might help you alot.

Grantmitch1 commented: Awesome +1