|
EDIT:
OOps, sorry Mark, replied to the wrong message!
ignore it.
|
|
|
|
|
When you use setInterval you are supposed to set it to a variable, which becomes its ID, in effect - eg
instead of just writing
setInterval("showN()",40);
as you have, you should write
var IntervalID = setInterval("showN()",40);
Then, later when you want to clear it, you must refer to that ID:
clearInterval(intervalID);
Edit: screw jQuery. Never found a use for it yet. DIY, always.
|
|
|
|
|
NeverHeardOfMe wrote: screw jQuery. Never found a use for it yet. DIY, always.
That's what we need, more people who refuse to learn and espouse the "always been done that way" dictum.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Not at all - my "objection" to the likes of jQuery is precicely that it *stops* one from learning - it's just a box of magic tricks and turns you into a dancing dog. I prefer to try and learn how to do things myself.
Of course the reducto ad absurdum of this argument is that we should all go back to coding in machine language, and I am aware of that and the sillines of re-inventing the wheel. Nevertheless, I do feel there is a certian merit to my position - how often do we see questions asked here from people who have clearly learned a few "tricks" but have absolutely no real understanding of what they asking about?
|
|
|
|
|
JQuery is not a black box, you have the full source code available to actually research and learn. With .NET Reflector I'm often looking at Microsoft's code to see how something was done and learning.
You're argument is a bit weak but not worth the effort to drag out.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
 I modified da code and put var ID... = setInterval(....)...,
but now it says da ID i gave is unidentified by browsers(both IE and Firefox).....
<br />
window.onload=inItAll;<br />
var j=0;<br />
var N=2;<br />
function inItAll()<br />
{<br />
document.getElementById("img1").onclick=click;<br />
}<br />
<br />
<br />
function click()<br />
{ <br />
<br />
if(navigator.appName=="Netscape")<br />
{<br />
j=0.9;<br />
<br />
var IntervalIDN1 = setInterval("fadeN()",40);
<br />
<br />
}<br />
else<br />
{<br />
j=90;<br />
var IntervalIDI1 = setInterval("fadeI()",40);
}<br />
<br />
}<br />
<br />
function fadeN()
{<br />
j=j-0.1<br />
<br />
if(j>0.4)<br />
{ <br />
<br />
document.getElementById("img1").style.opacity= j;<br />
}<br />
else<br />
{<br />
j=0.4;<br />
window.clearInterval(IntervalIDN1);<br />
<br />
document.getElementById("img1").src = "images/"+N+".jpg";<br />
<br />
var IntervalIDN2 = setInterval("showN()",40);<br />
<br />
} <br />
<br />
}<br />
<br />
function showN()
{<br />
<br />
if(j<1)<br />
{<br />
document.getElementById("img1").style.opacity= j;<br />
j=0.1 + j;<br />
<br />
}<br />
else<br />
{<br />
window.clearInterval(IntervalIDN2);<br />
document.getElementById("img1").style.opacity= 1;<br />
<br />
}<br />
}<br />
<br />
function fadeI()
{<br />
j=j-10<br />
<br />
if(j>40)<br />
{ <br />
document.getElementById("img1").style.filter ="alpha(opacity="+j+")";<br />
<br />
}<br />
else<br />
{<br />
j=40;<br />
window.clearInterval(IntervalIDI1);<br />
<br />
document.getElementById("img1").src = "images/2.jpg";<br />
<br />
var IntervalIDI2 = setInterval("showI()",40);<br />
} <br />
<br />
}<br />
<br />
function showI()
{<br />
<br />
if(j<100)<br />
{<br />
document.getElementById("img1").style.filter ="alpha(opacity="+j+")";<br />
j=10 + j;<br />
<br />
}<br />
else<br />
{<br />
document.getElementById("img1").style.filter ="alpha(opacity="+100+")";<br />
window.clearInterval(IntervalIDI2);<br />
<br />
}<br />
}<br />
if i remove ids it works perfectly on Firefox but not on IE....
|
|
|
|
|
well you need to define the var IntervalID outside of the functions (so that it is globally accessible to all), and then justs et it within
var IntervalID;
...
function XYZ () {
IntervalID = ...
}
|
|
|
|
|
|
i was creating little animation using javascript....but got stuck
<br />
<html><br />
<head><br />
<style type="text/css"><br />
body{}<br />
.imgC{width:350px; height:300px;}<br />
#divV{background-color:#000000; opacity:0.6; filter:alpha(opacity=60);<br />
width:350px; height:70px;}<br />
#mainDiv{width:100%; height:100%; background-color:#c3c3c3; top:0px; left:0px;<br />
position:absolute;} <br />
</style><br />
<script language="javascript"><br />
window.onload=inItAll;<br />
<br />
function inItAll()<br />
{<br />
document.getElementById("img1").onmouseover = cursorOver;<br />
document.getElementById("img1").onmouseout = cursorOut;<br />
document.getElementById("divV").onmouseout = cursorVOut;<br />
<br />
<br />
}<br />
<br />
function cursorOver()<br />
{<br />
<br />
if(!document.getElementById("divV"))<br />
{<br />
var Y1 = document.getElementById("img1").offsetTop;<br />
var X1 = document.getElementById("img1").offsetLeft;<br />
var Elem = document.createElement("div");<br />
Elem.id="divV";<br />
Elem.cssClass="divVc";<br />
Elem.style.position="absolute";<br />
Elem.style.top = 230+Y1+"px";<br />
Elem.style.left = X1+"px";<br />
document.getElementById("div1").appendChild(Elem);<br />
}<br />
}<br />
<br />
function cursorOut(e)<br />
{<br />
var Y1 = document.getElementById("img1").offsetTop;<br />
var Y2 = Y1 + 300;<br />
var X1 = document.getElementById("img1").offsetLeft;<br />
var X2 = X1 + 350;<br />
if (!e)<br />
var e = window.event;<br />
<br />
if (e.pageX || e.pageY) {<br />
posx = e.pageX;<br />
posy = e.pageY;<br />
<br />
}<br />
else if (e.clientX || e.clientY) {<br />
posx = e.clientX <br />
posy = e.clientY <br />
}<br />
<br />
if(posx>=X1 && posx<=X2 && posy>=Y1 && posy<=Y2)<br />
{<br />
<br />
<br />
}<br />
else<br />
{<br />
<br />
var Elem = document.getElementById("divV");<br />
document.getElementById("div1").removeChild(Elem);<br />
<br />
<br />
<br />
}<br />
<br />
}<br />
<br />
function cursorVOut()<br />
{<br />
<br />
var Elem = document.getElementById("divV");<br />
document.getElementById("div1").removeChild(Elem);<br />
<br />
}<br />
<br />
</script><br />
</head><br />
<body><br />
<div id="mainDiv"><br />
<div id="div1"><br />
<center><br />
<img src="images/1.jpg" id="img1" class="imgC"/><br />
</center><br />
</div><br />
</div><br />
<br />
</body><br />
</html> <br />
everything works fine except document.getElementById("divV").onmouseout = cursorVOut;
this part is not working.....
when i bring cursor on image(img1) a small div appears at the bottom of image and if i move my cursor out it should disappear...the problem is when i move my cursor away frm divV to mainDiv event doesn,t work......
|
|
|
|
|
Personally I can't see how any of it works. Your onload function refers to divV before it has even been defined.
Can I suggest you try using the Error console in Firefox to try debugging your JavaScript....
|
|
|
|
|
Hi,
I have below code to open pop-under window.but it blocked by the browser.
please tell me how can unblock a pop-under using java script.
<SCRIPT LANGUAGE='JAVASCRIPT' TYPE='TEXT/JAVASCRIPT'>
function openwin()
{
window.open("http://www.yahoo.com");
}
</script>
<body onLoad="openwin();">
|
|
|
|
|
jasimmd wrote: please tell me how can unblock a pop-under using java script.
At the browser level, people block things for any number of reason. Why do you want to usurp the people's privileges and rights?
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Pop ups are generally allowed by blockers as long as the popup was initiated by a user action. Therefore, the answer to your question is to allow the user to click a button/link tto open the popup, and not to do it onload (which is a favourite trick of the popup advertiser - hence why they're blocked).
If you could disable this using javascript, it would negate the usefullness of popup blockers in the first place.
|
|
|
|
|
I want to provide sitemap with scrolling of images. I'm handling the method for scrolling image as in "Text and Image Crawler" of Dynamicdrive.com (http://www.dynamicdrive.com/dynamicindex2/crawler/index.htm). I've just changed the images and added a click event for images. The crawler.js is the same as in the "Text and Image Crawler" of Dynamicdrive.com.
In my application thing is for services, there is submenus. When the services image is clicked.. the marque movement should be paused until other than services (home, about_us, careers, contact_us) is clicked and the images of the submenu should get displayed. When other than services is clicked, the display of the submenu images must be in hide condition. IS it possible to do so. If so guide and help me.
Currently, I'd hide the submenu images by setting the property 'display:none;' for the div-id in styles.css. And when clicked i've coded to display the submenu images with javascript. But not working.
My html code is:
*****************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0" />
<meta name="ProgId" content="FrontPage.Editor.Document" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>My Project</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="js/scroll-image.js"></script>
<script type="text/javascript" src="js/crawler.js"></script>
<!-- [if gte IE 7]><!-->
<link type="text/css" rel="stylesheet" href="css/style-ie6.css" />
<!--<![endif]-->
</head>
<body style="line-height: 150%">
<div>
<div style=" background:#E3E1E2; width: 766px; margin: 0px auto">
<p class="body_text_heading" align=left><br> <br> Sitemap<br> <br> <br> <br> </p>
<div style=" background:#E3E1E2; width: 730px; margin: 0px auto;">
<div class="marquee" id="image_scroll">
<img src="images/site_home.jpg" width="300" height="300" alt="Home" id="1_img" onclick="scrollimage('home');";/>
<img src="images/site_about_us.jpg" width="300" height="300" alt="About Us" id="2_img" onclick="scrollimage('about_us');"/>
<img src="images/site_careers.jpg" width="300" height="300" alt="Careers" id="3_img" onclick="scrollimage('careers');"/>
<img src="images/site_services.jpg" width="300" height="300" alt="Services" id="4_img" onclick="scrollimage('services');"/>
<img src="images/site_contact_us.jpg" width="300" height="300" alt="Contact Us" id="5_img" onclick="scrollimage('contact_us');"/>
</div>
<p class="body_text_heading" align=left><br> <br> <br> </p>
<script type="text/javascript">
marqueeInit({
uniqueid: 'image_scroll',
style: {
'padding': '2px',
'width': '700px',
'height': '300px'
},
inc: 5,
mouse: 'cursor driven',
direction: 'left',
noAddedSpace: false,
stopped: false,
moveatleast: 4,
neutral: 150,
savedirection: 'true'
});
</script>
<div id="subScroll">
<div class="marquee" id="image_scroll_sub">
<img src="images/site_knowledge.jpg" width="300" height="300" alt="Knowledge Transfer" id="6_img" onclick="scrollimage('knowledge');";/>
<img src="images/site_business_consultancy.jpg" width="300" height="300" alt="About Us" id="7_img" onclick="scrollimage('business_consultancy');"/>
<img src="images/site_hrd.jpg" width="300" height="300" alt="Careers" id="8_img" onclick="scrollimage('hrd');"/>
<img src="images/site_carbon_credits.jpg" width="300" height="300" alt="Services" id="9_img" onclick="scrollimage('carbon_credits');"/>
<img src="images/site_hedge.jpg" width="300" height="300" alt="Contact Us" id="10_img" onclick="scrollimage('hedge');"/>
</div>
<p class="body_text_heading" align=left><br> <br> <br> </p>
<script type="text/javascript">
marqueeInit({
uniqueid: 'image_scroll_sub',
style: {
'padding': '5px',
'width': '500px',
'height': '300px'
},
inc: 5,
mouse: 'cursor driven',
direction: 'right',
noAddedSpace: false,
stopped: false,
moveatleast: 4,
neutral: 150,
savedirection: 'true'
});
</script>
</div>
</div>
</div>
</div>
</body>
</html>
Scrollimage function within scroll-image.js
*******************************************
function scrollimage(getDirection){
initScroll();
if(getDirection=='home')
{
document.getElementById('subScroll').style.display='none';
alert("home");
}
if(getDirection=='about_us')
{
document.getElementById('subScroll').style.display='none';
alert("about_us");
}
if(getDirection=='careers')
{
document.getElementById('subScroll').style.display='none';
alert("careers");
}
if(getDirection=='services')
{
document.getElementById('subScroll').style.position='relative';
document.getElementById('subScroll').style.display='inline';
alert("services");
}
if(getDirection=='contact_us')
{
document.getElementById('subScroll').style.display='none';
alert("contact_us");
}
if(getDirection=='knowledge')
{
document.getElementById('subScroll').style.display='inline';
alert("knowledge");
}
if(getDirection=='business_consultancy')
{
document.getElementById('subScroll').style.display='inline';
alert("business_consultancy");
}
if(getDirection=='hrd')
{
document.getElementById('subScroll').style.display='inline';
alert("hrd");
}
if(getDirection=='carbon_credits')
{
document.getElementById('subScroll').style.display='inline';
alert("carbon_credits");
}
if(getDirection=='hedge')
{
document.getElementById('subScroll').style.display='inline';
alert("hedge");
}
function initScroll()
{
document.getElementById('subScroll').style.display='none';
}
}
Content of div-id(subScroll) in style.css
*****************************************
#subScroll
{
display:none;
}
M.Sworna Vidhya
|
|
|
|
|
Hai
I am trying scrolling of images as like (http://www.dynamicdrive.com/dynamicindex2/crawler/index.htm). I do want to set border for the images with border property as "2px solid #000" and i do want gap between the images so that the horizontal gap value is 20px.
I tried even with image border propoerty and image style properties both border and padding as 0 20px. Both not working properly. The style padding property is working fine in firefox and google chrome. But it is working in IE 6.0
I'll paste my code for your reference.
********************************************************************************
HTML CODE IS
********************************************************************************
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/javascript" src="crawler.js">
</script>
</head>
<body>
<div class="marquee" id="mycrawler">
Those confounded friars dully buzz that faltering jay. An appraising tongue acutely causes our courageous hogs. Their fitting submarines deftly break your approving improvisations. Her downcast taxonomies actually box up those disgusted turtles.
</div>
<script type="text/javascript">
marqueeInit({
uniqueid: 'mycrawler',
style: {
'padding': '5px',
'width': '150px',
'background': 'lightyellow',
'border': '1px solid #CC3300'
},
inc: 8,
mouse: 'cursor driven',
moveatleast: 4,
neutral: 150,
savedirection: true
});
</script>
<div class="marquee" id="mycrawler2">
<img src="http://i40.tinypic.com/9tlic8.jpg" style="padding:0 20px;" onclick="javascript:alert('9tlic8.jpg')";/>
<img src="http://i43.tinypic.com/1zbqs5t.jpg" style="padding:0 20px;" onclick="javascript:alert('1zbqs5t.jpg')"/>
<img src="http://i44.tinypic.com/2419ul3.jpg" style="padding:0 20px;" onclick="javascript:alert('2419ul3.jpg')"/>
<img src="http://i43.tinypic.com/296nh3r.jpg" style="padding:0 20px;" onclick="javascript:alert('296nh3r.jpg')"/>
<img src="http://i40.tinypic.com/mk7ki.jpg" style="padding:0 20px;" onclick="javascript:alert('mk7ki.jpg')"/>
</div>
<script type="text/javascript">
marqueeInit({
uniqueid: 'mycrawler2',
style: {
'padding': '2px',
'width': '700px',
'height': '180px'
},
inc: 5,
mouse: 'cursor driven',
direction: 'right',
noAddedSpace: false,
stopped: false,
moveatleast: 4,
neutral: 150,
savedirection: 'true'
});
</script>
</body>
</html>
********************************************************************************
Javascript CODE IS(crawler.js)
********************************************************************************
function marqueeInit(config){
if(!document.createElement) return;
marqueeInit.ar.push(config);
marqueeInit.run(config.uniqueid);
}
(function(){
if(!document.createElement) return;
marqueeInit.ar = [];
document.write('<style type="text/css">.marquee{white-space:nowrap;overflow:hidden;visibility:hidden;}' +
'#marq_kill_marg_bord{border:none!important;margin:0!important;}<\/style>');
var c = 0, tTRE = [new RegExp('^\\s*$'), new RegExp('^\\s*'), new RegExp('\\s*$')],
req1 = {'position': 'relative', 'overflow': 'hidden'}, defaultconfig = {
style: {
'margin': '0 auto'
},
direction: 'left',
inc: 2,
mouse: 'pause'
}, dash, ie = false, oldie = 0, ie5 = false, iever = 0;
if(!ie5){
dash = new RegExp('-(.)', 'g');
function toHump(a, b){return b.toUpperCase();};
String.prototype.encamel = function(){return this.replace(dash, toHump);};
}
if(ie && iever < 8){
marqueeInit.table = [];
window.attachEvent('onload', function(){
marqueeInit.OK = true;
for(var i = 0; i < marqueeInit.table.length; ++i)
marqueeInit.run(marqueeInit.table[i]);
});
}
function intable(el){
while((el = el.parentNode))
if(el.tagName && el.tagName.toLowerCase() === 'table')
return true;
return false;
};
marqueeInit.run = function(id){
if(ie && !marqueeInit.OK && iever < 8 && intable(document.getElementById(id))){
marqueeInit.table.push(id);
return;
}
if(!document.getElementById(id))
setTimeout(function(){marqueeInit.run(id);}, 300);
else
new Marq(c++, document.getElementById(id));
}
function trimTags(tag){
var r = [], i = 0, e;
while((e = tag.firstChild) && e.nodeType == 3 && tTRE[0].test(e.nodeValue))
tag.removeChild(e);
while((e = tag.lastChild) && e.nodeType == 3 && tTRE[0].test(e.nodeValue))
tag.removeChild(e);
if((e = tag.firstChild) && e.nodeType == 3)
e.nodeValue = e.nodeValue.replace(tTRE[1], '');
if((e = tag.lastChild) && e.nodeType == 3)
e.nodeValue = e.nodeValue.replace(tTRE[2], '');
while((e = tag.firstChild))
r[i++] = tag.removeChild(e);
return r;
}
function Marq(c, tag){
var p, u, s, a, ims, ic, i, marqContent, cObj = this;
this.mq = marqueeInit.ar[c];
for (p in defaultconfig)
if((this.mq.hasOwnProperty && !this.mq.hasOwnProperty(p)) || (!this.mq.hasOwnProperty && !this.mq[p]))
this.mq[p] = defaultconfig[p];
this.mq.style.width = !this.mq.style.width || isNaN(parseInt(this.mq.style.width))? '100%' : this.mq.style.width;
if(!tag.getElementsByTagName('img')[0])
this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? tag.offsetHeight + 3 + 'px' : this.mq.style.height;
else
this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? 'auto' : this.mq.style.height;
u = this.mq.style.width.split(/\d/);
this.cw = this.mq.style.width? [parseInt(this.mq.style.width), u[u.length - 1]] : ['a'];
marqContent = trimTags(tag);
tag.className = tag.id = '';
tag.removeAttribute('class', 0);
tag.removeAttribute('id', 0);
if(ie)
tag.removeAttribute('className', 0);
tag.appendChild(tag.cloneNode(false));
tag.className = ['marquee', c].join('');
tag.style.overflow = 'hidden';
this.c = tag.firstChild;
this.c.appendChild(this.c.cloneNode(false));
this.c.style.visibility = 'hidden';
a = [[req1, this.c.style], [this.mq.style, this.c.style]];
for (i = a.length - 1; i > -1; --i)
for (p in a[i][0])
if((a[i][0].hasOwnProperty && a[i][0].hasOwnProperty(p)) || (!a[i][0].hasOwnProperty))
a[i][1][p.encamel()] = a[i][0][p];
this.m = this.c.firstChild;
if(this.mq.mouse == 'pause'){
this.c.onmouseover = function(){cObj.mq.stopped = true;};
this.c.onmouseout = function(){cObj.mq.stopped = false;};
}
this.m.style.position = 'absolute';
this.m.style.left = '-10000000px';
this.m.style.whiteSpace = 'nowrap';
if(ie5) this.c.firstChild.appendChild((this.m = document.createElement('nobr')));
if(!this.mq.noAddedSpace)
this.m.appendChild(document.createTextNode('\xa0'));
for(i = 0; marqContent[i]; ++i)
this.m.appendChild(marqContent[i]);
if(ie5) this.m = this.c.firstChild;
ims = this.m.getElementsByTagName('img');
if(ims.length){
for(ic = 0, i = 0; i < ims.length; ++i){
ims[i].style.display = 'inline';
ims[i].style.verticalAlign = ims[i].style.verticalAlign || 'top';
if(typeof ims[i].complete == 'boolean' && ims[i].complete)
ic++;
else {
ims[i].onload = function(){
if(++ic == ims.length)
cObj.setup();
};
}
if(ic == ims.length)
this.setup();
}
}
else this.setup()
}
Marq.prototype.setup = function(){
if(this.mq.setup) return;
this.mq.setup = this;
var s, cObj = this;
if(this.c.style.height === 'auto')
this.c.style.height = this.m.offsetHeight + 4 + 'px';
this.c.appendChild(this.m.cloneNode(true));
this.m = [this.m, this.m.nextSibling];
if(this.mq.mouse == 'cursor driven'){
this.r = this.mq.neutral || 16;
this.sinc = this.mq.inc;
this.c.onmousemove = function(e){cObj.mq.stopped = false; cObj.directspeed(e)};
if(this.mq.moveatleast){
this.mq.inc = this.mq.moveatleast;
if(this.mq.savedirection){
if(this.mq.savedirection == 'reverse'){
this.c.onmouseout = function(e){
if(cObj.contains(e)) return;
cObj.mq.inc = cObj.mq.moveatleast;
cObj.mq.direction = cObj.mq.direction == 'right'? 'left' : 'right';};
} else {
this.mq.savedirection = this.mq.direction;
this.c.onmouseout = function(e){
if(cObj.contains(e)) return;
cObj.mq.inc = cObj.mq.moveatleast;
cObj.mq.direction = cObj.mq.savedirection;};
}
} else
this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.mq.inc = cObj.mq.moveatleast;};
}
else
this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.slowdeath();};
}
this.w = this.m[0].offsetWidth;
this.m[0].style.left = 0;
this.c.id = 'marq_kill_marg_bord';
this.m[0].style.top = this.m[1].style.top = Math.floor((this.c.offsetHeight - this.m[0].offsetHeight) / 2 - oldie) + 'px';
this.c.id = '';
this.c.removeAttribute('id', 0);
this.m[1].style.left = this.w + 'px';
s = this.mq.moveatleast? Math.max(this.mq.moveatleast, this.sinc) : (this.sinc || this.mq.inc);
while(this.c.offsetWidth > this.w - s)
this.c.style.width = isNaN(this.cw[0])? this.w - s + 'px' : --this.cw[0] + this.cw[1];
this.c.style.visibility = 'visible';
this.runit();
}
Marq.prototype.slowdeath = function(){
var cObj = this;
if(this.mq.inc){
this.mq.inc -= 1;
this.timer = setTimeout(function(){cObj.slowdeath();}, 100);
}
}
Marq.prototype.runit = function(){
var cObj = this, d = this.mq.direction == 'right'? 1 : -1;
if(this.mq.stopped || this.mq.stopMarquee){
setTimeout(function(){cObj.runit();}, 300);
return;
}
if(this.mq.mouse != 'cursor driven')
this.mq.inc = Math.max(1, this.mq.inc);
if(d * parseInt(this.m[0].style.left) >= this.w)
this.m[0].style.left = parseInt(this.m[1].style.left) - d * this.w + 'px';
if(d * parseInt(this.m[1].style.left) >= this.w)
this.m[1].style.left = parseInt(this.m[0].style.left) - d * this.w + 'px';
this.m[0].style.left = parseInt(this.m[0].style.left) + d * this.mq.inc + 'px';
this.m[1].style.left = parseInt(this.m[1].style.left) + d * this.mq.inc + 'px';
setTimeout(function(){cObj.runit();}, 30 + (this.mq.addDelay || 0));
}
Marq.prototype.directspeed = function(e){
e = e || window.event;
if(this.timer) clearTimeout(this.timer);
var c = this.c, w = c.offsetWidth, l = c.offsetLeft, mp = (typeof e.pageX == 'number'?
e.pageX : e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft) - l,
lb = (w - this.r) / 2, rb = (w + this.r) / 2;
while((c = c.offsetParent)) mp -= c.offsetLeft;
this.mq.direction = mp > rb? 'left' : 'right';
this.mq.inc = Math.round((mp > rb? (mp - rb) : mp < lb? (lb - mp) : 0) / lb * this.sinc);
}
Marq.prototype.contains = function(e){
if(e && e.relatedTarget){var c = e.relatedTarget; if(c == this.c) return true;
while ((c = c.parentNode)) if(c == this.c) return true;}
return false;
}
function resize(){
for(var s, m, i = 0; i < marqueeInit.ar.length; ++i){
if(marqueeInit.ar[i] && marqueeInit.ar[i].setup){
m = marqueeInit.ar[i].setup;
s = m.mq.moveatleast? Math.max(m.mq.moveatleast, m.sinc) : (m.sinc || m.mq.inc);
m.c.style.width = m.mq.style.width;
m.cw[0] = m.cw.length > 1? parseInt(m.mq.style.width) : 'a';
while(m.c.offsetWidth > m.w - s)
m.c.style.width = isNaN(m.cw[0])? m.w - s + 'px' : --m.cw[0] + m.cw[1];
}
}
}
if (window.addEventListener)
window.addEventListener('resize', resize, false);
else if (window.attachEvent)
window.attachEvent('onresize', resize);
})();
***************************************************************************
END OF CODING PART
***************************************************************************
Kindly help me.
M.Sworna Vidhya
|
|
|
|
|
HI guys
how can i check whether java installed or not in client machine when page is being loading
using Javascript, bcz i have html page and using applet in this page to show something.
basically need to check if java installed show apple tag else hide that.
Thanks in adv
Shafiq
|
|
|
|
|
|
I Need to get the value attribute to change to different numbers that I want to change in script parts based on user input so that the form will post a message to a different place depening on what they choose, but whatever I try it won't change, or at least not in time so that it posts right
<br />
<form id='commentForm' action='http://www.urlhere app=members&module=profile§ion=comments&do=add_new_comment' method='post'><br />
<br />
<fieldset><br />
<br />
<input type='hidden' name='member_id' id='number' value='***' /><br />
<script type="text/javascript"><br />
document.getElementBytagName("member_id").value="40603";<br />
</script><br />
<div id='post_comment' class='clear row2'><br />
<br />
<textarea class='input_textarea' cols='0' rows='0' id='comment_text' name='comment_text'>Hello.</textarea><br />
<br /><br />
<input type='submit' class='clear input_submit' value='Post' id='comment_submit' /><br />
<br />
<br />
</div><br />
</fieldset><br />
</form>
|
|
|
|
|
document.getElementsByTagName
try it this way
(it will probably work but there is no gaurentee
that the dom will be ready, you should move the script
block to the end ot the page)
<input type='hidden' name='member_id' id='number' value='***' />
<script type="text/javascript">
document.getElementById("number").value="40603";
</script>
|
|
|
|
|
Thanks a lot, it worked.
One more question.. varibles..
Tried asigning it one like this:
int num = 4321;
document.getElementById("number").value=num;
but that way didn't do it..
|
|
|
|
|
Declare the variable as :
var num;
|
|
|
|
|
Hmm thought thats what I did the first time without getting anywhere.. Was 2 am though. Thanks.
|
|
|
|
|
hi,
i developed login page with model popup extender and my problem to open login window with out Menu bar.
How can i solve it and suggest me better way.
Thanks & Regrads,
Vishnu.
|
|
|
|
|
|
hi,
Actually We Used The Modalpop extender but the problem is not with that.
i designed a login page. in that i should not have the menu bar when i run the page in ie6.
so please suggest b better way to hide the menubar in ie6.
thanks in advance
|
|
|
|
|